1

I'm trying to finish up my image uploader that utilizes imagick for the handling of various image types. One thing specifically that I'm trying to get working is the conversion of jpeg files to progressive jpeg. I've tried the following code below, but when I view the images that get output in irfranview, the jpeg are not progressive. Any ideas? This literally must work by Monday.. Please help

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);
}

Any ideas as to why this isn't outputting progressive jpegs?

Cœur
  • 37,241
  • 25
  • 195
  • 267
Braydon Batungbacal
  • 1,028
  • 2
  • 24
  • 52

1 Answers1

1

I know this thread is old but here is an answer that might save time to others in the future.

So since you are reading an image from file, you should use the following method instead: Imagick::setInterlaceScheme

It seems that Imagick::setImageInterlaceScheme will work only when Imagick is used to generate an image by itself...

healdev
  • 11
  • 1