PHP-如何将JPEG图像保存为渐进JPEG?
作者:互联网
我具有以下将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