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?

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?

Braydon Batungbacal
  • 1,028
  • 2
  • 24
  • 52

1 Answers1

3

Use setInterlaceScheme instead of setImageInterlaceScheme - the latter doesn't appear to do anything, but the former works just fine for me.

ArtOfWarfare
  • 20,617
  • 19
  • 137
  • 193
WJS
  • 49
  • 3
  • Modified this to sound more like an answer and less like a comment, in response to someone having flagged it as "not an answer". This is now definitely an attempt at an answer and shouldn't be flagged, but if it's wrong (I have no experience with PHP so I couldn't say whether it is or not) you should down vote, not flag, it. – ArtOfWarfare Nov 17 '14 at 03:45
  • I believe the setImageInterlaceScheme is supposed to be used when *creating* images with Imagick, rather than editing existing. A similar pair of methods exists for a lot of things. – Bell Aug 27 '17 at 00:01