Jump to content

Recommended Posts

Posted

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

Posted

For what I have experienced, the interlace parameter should be enough. Also, be aware that any previously created image won't behave as progressive. 

Posted
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??

Posted
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!

  • Like 1
Posted
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.

  • Like 1
Posted (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 by szabesz
typo
Posted
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.

  • Like 1
Posted
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.

  • 5 years later...
Posted

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!

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...