Robin S Posted June 14, 2017 Share Posted June 14, 2017 It seems that ImageSizerEngineIMagick ignores the 'quality' setting if one is defined in $config->imageSizerOptions. So if in /site/config.php I have... $config->imageSizerOptions = array_merge($config->imageSizerOptions, ['quality' => 10, 'forceNew' => true]); ...and in my template... echo "<img src='{$my_image->size(300, 300)->url}' alt=''>"; ...then I do not get an image with a quality of 10 (instead it seems to use the default quality defined in the module config). But if I do this then it works... echo "<img src='{$my_image->size(300, 300, ['quality' => 10])->url}' alt=''>"; Weird that this one option would be ignored from $config->imageSizerOptions. @horst or anyone: is this a bug? On the topic of the quality setting, '80' seems too low for the default - I can see some fairly obvious artifacts at that quality. In the blog post that introduced the module, Ryan said: Quote I've found that I can use a lower quality setting in IMagick and get the same result as in GD. For instance, my subjective opinion is that a quality setting of 85 in IMagick is equivalent to a quality setting of 90 in GD, and produces similar file sizes. So given the default GD quality is 90, shouldn't the default quality for ImageSizerEngineIMagick be 85 to have consistency across the two sizer engines? Link to comment Share on other sites More sharing options...
horst Posted June 14, 2017 Share Posted June 14, 2017 I think it is some sort of bug. But not that way you would think first, I believe: It is a feature that is/should be configurable, but the User-Interface is missing. Explanation: With multiple, different render engines, we need different quality settings for them. Per default, the module settings overwrite the configsetting, but it should be configurable to disable this. For example in CroppableImage it is configurable: But for regular (GD) image rendering there is no module config screen. Maybe we need to add a new param for this to the $config->imageSizerOptions like "useEngineQualitysettings", per default = true. Let's ping @ryan! 1 Link to comment Share on other sites More sharing options...
horst Posted June 14, 2017 Share Posted June 14, 2017 @Robin S: As a workaround, until this is fixed, you dynamicaly/temporary may set the 10% to all engines? A codesnippet in an init (or ready.php) file, where you set / change one param from 0 to 100 instead of changing the site/config.php Startingpoint: https://github.com/horst-n/CroppableImage3/blob/0946fdce7b1c9859f94adf764df80d73c201bbbc/FieldtypeCroppableImage3/FieldtypeCroppableImage3ConfAdaptor.php#L91-L97 Link to comment Share on other sites More sharing options...
Robin S Posted June 14, 2017 Author Share Posted June 14, 2017 21 minutes ago, horst said: With multiple, different render engines, we need different quality settings for them. Per default, the module settings overwrite the configsetting, but it should be configurable to disable this. I checked the 'sharpening' setting in $config and that is also overridden by the module config settings. Do you think having module config fields for these default settings is necessary? PW devs are already used to defining the image sizer defaults using $config->imageSizerOptions so would it not be better to stick with that alone? Or do you mean that some devs use both GD and ImageMagick engines in a single PW installation and therefore you need to be able to set different defaults for each? Link to comment Share on other sites More sharing options...
horst Posted June 14, 2017 Share Posted June 14, 2017 (edited) Image rendering engines are always used together / in parallel. Or, in other words, the GD engine cannot be disabled, it is always on as a fallback or last standing man. The image rendering procedure in short: image inspector extract all relevant infos about image type, subtypes, optional layers, etc, and give back a descripting paramvalue according to the return of image inspector, all available rendering engines get "asked" in hirarchical order if they can handle this type of fileformat / subformat the first that matches will get the job and as an additional fallback, if it somehow made a false promise and failed with the rendering, the image will be handed over to GD engine (or the next in hirarchy) Lots of stuff under the hood! ----- To your question: I think it is fine to keep the default values in site/config (together with the missing param for what overrides what). But when enabling an additional rendering engine, you are already in the configscreen and can set the "optional" default settings there. Edited June 14, 2017 by horst 2 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