我具有以下將JPEG保存為漸進JPEG的功能.它已保存,但不是漸進式JPEG.這個對嗎 ?
function save($filename, $image_type = IMAGETYPE_JPEG, $compression = 75, $permissions = null) {
if ($image_type == IMAGETYPE_JPEG) {
imageinterlace($this->image, true); //convert to progressive ?
imagejpeg($this->image, $filename, $compression);
} elseif ($image_type == IMAGETYPE_GIF) {
imagegif($this->image, $filename);
} elseif ($image_type == IMAGETYPE_PNG) {
imagepng($this->image, $filename);
}
if ($permissions != null) {
chmod($filename, $permissions);
}
}
這就是我所謂的save()函數的方式:
function img_reconstruct($saveto) {
$image = new SimpleImage();
$image->load($saveto);
list($width, $height) = getimagesize($saveto);
if ($width > 800 && $width < 1200) {
$image->resize(800, $height);
$image->save($saveto);
}
}
解決方法:
嘗試如下
imageinterlace($this->image, 1); //convert to progressive ?
類型轉換可能有問題
標簽:image,jpeg,php,progressive
來源: https://codeday.me/bug/20191101/1984698.html