我正在尝试完成我的图像上传器,它利用imagick来处理各种图像类型。我正在努力工作的一件事是将jpeg文件转换为渐进式jpeg。我在下面尝试了下面的代码,但是当我查看在irfranview中输出的图像时,jpeg不是渐进式的。有什么想法吗?
foreach ($thumbnailScaleWidths as $thumbnailScaleWidth) {
$thumbnail = new imagick($uploadedFile['tmp_name']);
$thumbnailDimensions = $thumbnail->getImageGeometry();
$thumbnailWidth = $thumbnailDimensions['width'];
$thumbnailHeight = $thumbnailDimensions['height'];
$thumbnailScaleHeight = ($thumbnailScaleWidth / $thumbnailWidth) * $thumbnailHeight;
$thumbnail->thumbnailImage($thumbnailScaleWidth, $thumbnailScaleHeight);
$thumbnail->setImageInterlaceScheme(Imagick::INTERLACE_PLANE);
$thumbnail->writeImages($_SERVER['DOCUMENT_ROOT'] . "/Resources/Media/$userId/$internalName-$thumbnailScaleWidth.$fileType", true);
}
为什么这不是输出渐进式jpeg的任何想法?
答案 0 :(得分:1)
使用setInterlaceScheme
代替setImageInterlaceScheme
- 后者似乎没有做任何事情,但前者对我来说效果很好。