我创建了一个从html5画布上传裁剪图像的函数,该函数运行正常。我唯一的问题是imageinterlace
函数没有创建
一个进步的jpeg。
if (is_uploaded_file($_FILES['image_file']['tmp_name'])) {
$tmp_name = $folder . $new_name;
move_uploaded_file($_FILES['image_file']['tmp_name'], $tmp_name);
if (file_exists($tmp_name) && filesize($tmp_name) > 0) {
$size = getimagesize($tmp_name);
switch($size[2]) {
case IMAGETYPE_JPEG:
$ext = '.jpg';
$v_image = @imagecreatefromjpeg($tmp_name);
break;
default:
return false;
}
imageinterlace($v_image, 1);
$destination_image = @imagecreatetruecolor( $request['width'], $request['height'] );
imagecopyresampled($destination_image, $v_image, 0, 0, (int)$request['x1'], (int)$request['y1'], (int)$request['width'], (int)$request['height'], (int)$request['w'], (int)$request['h']);
$result_name = $tmp_name . $ext;
imagejpeg($destination_image, $result_name, 90);
}
}
我做错了什么?