使用php上载照片时出现“在进程中调整大小”错误
我在这段代码中有错误:使用php上载照片时出现“在进程中调整大小”错误,php,Php,我在这段代码中有错误: copy($newFile,$target_dir.'slider_'.$newName); $file2 = $target_dir.'slider_'.$newName; //This is the original file list($width2, $height2) = $newFile; $modwidth2 = 750; $modheight2 = 300; $tn2 = imagecreatetruecolor($modwidt
copy($newFile,$target_dir.'slider_'.$newName);
$file2 = $target_dir.'slider_'.$newName; //This is the original file
list($width2, $height2) = $newFile;
$modwidth2 = 750;
$modheight2 = 300;
$tn2 = imagecreatetruecolor($modwidth2, $modheight2);
if ($imageFileType == "jpg"){
$image2 = imagecreatefromjpeg($newFile);
imagecopyresampled($tn2, $image2, 0, 0, 0, 0, $modwidth2, $modheight2, $width2, $height2);
imagejpeg($tn2, $file2, 50);
} elseif ($imageFileType == "png"){
imagealphablending($tn2, false);
imagesavealpha($tn2, true);
$image2 = imagecreatefrompng($newFile);
imagecopyresampled($tn2, $image2, 0, 0, 0, 0, $modwidth2, $modheight2, $width2, $height2);
imagepng($tn2, $file2, 9);
} elseif ($imageFileType == "jpeg"){
$image2 = imagecreatefromjpeg($newFile);
imagecopyresampled($tn2, $image2, 0, 0, 0, 0, $modwidth2, $modheight2, $width2, $height2);
imagejpeg($tn2, $file2, 9);
}
如果我上传照片,输出总是空白的黑色。你能告诉我这段代码有什么问题吗?你没有正确获得宽度和高度
list($width2, $height2) = $newFile;
改为
list($width2, $height2) = getimagesize ($newFile)
您没有正确获取宽度和高度
list($width2, $height2) = $newFile;
改为
list($width2, $height2) = getimagesize ($newFile)
列表($width2,$height2)=$newFile;这是什么意思?它可能是list($width2,$height2)=getimagesize($newFile)从$newFile获取列表宽度和高度,将其PhotoList($width2,$height2)=$newFile归档;这是什么意思?它可能是列表($width2,$height2)=getimagesize($newFile)从$newFile获取列表宽度和高度,并将其照片归档