Peter Knight Posted January 29, 2019 Share Posted January 29, 2019 Is there a way to make JPGs progressive by default via the API? I've added the following to my site/config.php file but user-uploaded images are often displayed as non progressive. $config->imageSizerOptions = array( 'upscaling' => true, // upscale if necessary to reach target size? 'cropping' => true, // crop if necessary to reach target size? 'autoRotation' => true, // automatically correct orientation? 'interlace' => true, // use interlaced JPEGs by default? (recommended) 'sharpening' => 'soft', // sharpening: none | soft | medium | strong 'quality' => 95, // quality: 1-100 where higher is better but bigger 'hidpiQuality' => 60, // Same as above quality setting, but specific to hidpi images 'defaultGamma' => 0.5, // defaultGamma: 0.5 to 4.0 or -1 to disable gamma correction (default=2.0) ); Thanks Link to comment Share on other sites More sharing options...
elabx Posted January 29, 2019 Share Posted January 29, 2019 For what I have experienced, the interlace parameter should be enough. Also, be aware that any previously created image won't behave as progressive. Link to comment Share on other sites More sharing options...
wbmnfktr Posted January 29, 2019 Share Posted January 29, 2019 I guess I'm totally wrong with that but somehow my mind tells me that you will need ImageMagick/IMagick support for this. 1 Link to comment Share on other sites More sharing options...
elabx Posted January 29, 2019 Share Posted January 29, 2019 15 minutes ago, wbmnfktr said: I guess I'm totally wrong with that but somehow my mind tells me that you will need ImageMagick/IMagick support for this. Apparently not! This is the file for the GD engine, found it in the github issues where where this feature was being discussed and @horst published changes for both GD and imagemagick engines. https://github.com/horst-n/processwire/blob/f072a52ccec7ffadd6831b5002ebd0b569274216/wire/core/ImageSizerEngineGD.php#L286 But maybe GD needs something else (some config?) to support it?? Link to comment Share on other sites More sharing options...
wbmnfktr Posted January 29, 2019 Share Posted January 29, 2019 Ok... my mind seems more reliable than I thought. ? I wish I could find that thread or post where it was discussed back than. 1 Link to comment Share on other sites More sharing options...
elabx Posted January 29, 2019 Share Posted January 29, 2019 1 hour ago, wbmnfktr said: I wish I could find that thread or post where it was discussed back than. Truth is I would have also assumed ImageMagick as a requirement! 1 Link to comment Share on other sites More sharing options...
dotnetic Posted January 29, 2019 Share Posted January 29, 2019 ImageMagick isn't required for progressive JPGs. GDlib also just works fine. You just need the interlace setting. See my originial request here https://github.com/processwire/processwire-requests/issues/134 1 Link to comment Share on other sites More sharing options...
Autofahrn Posted January 30, 2019 Share Posted January 30, 2019 Probably totally stupid question, but do the user-uploaded images go through PW-side image processing at all? 1 Link to comment Share on other sites More sharing options...
Peter Knight Posted January 30, 2019 Author Share Posted January 30, 2019 22 minutes ago, Autofahrn said: Probably totally stupid question, but do the user-uploaded images go through PW-side image processing at all? I have some width and height restrictions on my images field so the image gets uploaded and resized. In this case I'd assume anything specified in the Quote $config->imageSizerOptions = array( gets applied. But i'm only guessing. 1 Link to comment Share on other sites More sharing options...
szabesz Posted January 30, 2019 Share Posted January 30, 2019 (edited) 7 hours ago, Autofahrn said: Probably totally stupid question, but do the user-uploaded images go through PW-side image processing at all? You can learn about it in this post: Also note that since ProcessWire 3.0.63 client-side resize gives us another option in the mix https://processwire.com/blog/posts/processwire-3.0.63-adds-client-side-image-resizing/ So it all depends on how you set it up and implement it. It is possible to serve unaltered images if you make sure PW does not touch it in the first place. However, it is only recommended for tech tech-savvy users or for special use cases. Edited January 30, 2019 by szabesz typo Link to comment Share on other sites More sharing options...
Autofahrn Posted January 30, 2019 Share Posted January 30, 2019 4 minutes ago, szabesz said: You can learn about it in this post: yup, it says Quote the original uploaded files never get altered So if an image is simply uploaded and downloaded without manipulation (i.e. sizing), the original, unaltered version should be retrieved. At least that's the case in all my setups. 1 Link to comment Share on other sites More sharing options...
szabesz Posted January 30, 2019 Share Posted January 30, 2019 5 minutes ago, Autofahrn said: yup, it says Quote the original uploaded files never get altered However, there are exceptions as noted ? the max size image imagefiled constrain and/or client-side image resizing might result in having a different file stored instead of the original supplied. Link to comment Share on other sites More sharing options...
Mfeuille Posted July 26 Share Posted July 26 Hello, I am using the srcset module in a very basic way and I am trying to combine with forced progressive JPG. Which (forced progressive JPG) works with the width() $options = array('forceNew' => true, 'interlace' => true, 'suffix' => 'srcset'); $imageProg = $image->width($image->width, $options); Can we force the variations created by the srcset to be automatically interlace ? Is there a way to force all API generated variations to follow this option without using the size() method ? I tried this with no success. $srcset = $imageProg->srcset; Thanks for your help! Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now