0

I am trying to navigate the Silverstripe Class definition for GDBackend and am having trouble setting the interlace value.

I am currently setting the quality in _config.php with:

config::inst()->update('GDBackend', 'default_quality', 60);

So i then tried to set the interlacing with the following:

config::inst()->update('GDBackend', 'image_interlace', 1);

Is this the correct method to setting these values? It is hard to know with all of the deprecation going on in this class.

When the image is uploaded the filesize is reduced - so the quality appears to be set correctly but the interlacing setting has no effect.

Also, the logs are free of any errors.

------------------- UPDATE:

After consulting the Silverstripe IRC channel I have moved the config settings into the yml with the following.

GDBackend: default_quality: 60 image_interlace: 1

Images are still not interlaced after upload.

I am using this tool to test for interlacing.

------------------- CONCLUSION:

It turns out that these settings are not a part of the upload processing and only apply to images generated by the CMS. For example images prefixed with something like SetWidth400-image-name.jpg will be interlaced and optimized as instructed by the yml config.

I will be looking into extending the upload module to give the user option to interlace images at the point of upload.

Thanks to colymba for his help clearing this up for me.

nickspiel
  • 5,170
  • 6
  • 33
  • 48

1 Answers1

2

Like you mentioned interlacing is set via YML config. To be enabled it should be anything else than 0, like mentioned in the PHP config If non-zero, the image will be interlaced, else the interlace bit is turned off.

Note that when you upload an image this one is not processed automatically on upload. Image quality and interlacing only applies to generated images.

colymba
  • 2,644
  • 15
  • 15
  • Oh ok, so the thumbnails and re sampled images should have the interlacing applied? I suppose that makes a lot of sense. I will check this out and see if it is working as intended. – nickspiel Mar 19 '14 at 23:19
  • I uploaded the image and plonked it into a WYSIWYG field (thinking that GD might run its magic over it when it is placed). The resulting image on the frontend still was not progressive. How would I force these setting for all uploaded images? – nickspiel Mar 19 '14 at 23:27
  • On a fresh install it all works fine for me. All generated images are interlaced, even via WYSIWYG. Also good to remember, if you request (WYSIWYG or template or setWidth...) an image the same size as you uploaded SS will serve the original, so no interlacing here. What's you config? Any special code? – colymba Mar 20 '14 at 07:30
  • We have been working on building out our boilerplate so the config is being cascaded by the config file in the boilerplate. Other than that, nothing terribly special. So I am clear, on the fresh install, you uploaded the image - ran a resize (or similar) in a tmeplate which produced an image with interlacing? And when you referenced the original uploaded image there was no interlacing? I will try this out and see if i get the same. I would to get this working on all uploaded images. – nickspiel Mar 20 '14 at 21:56
  • just a thought too, if you have different yml config, e.g. from your boilerplate + project, make the config your want to use doesn't get overridden. – colymba Mar 21 '14 at 07:16
  • This configuration yml stuff is a bit of a mystery to me. Do they override each other(if so how do you make one the default) or do they compliment each other? I assumed the latter oh wise boilerplate would be impossible. – nickspiel Mar 23 '14 at 21:22
  • in yml the config value don't always override themselves, normally array merge and non array override, the the highest priority config being used. You an set priorities with the `before`/`after` keywords http://doc.silverstripe.org/framework/en/topics/configuration#priorities Try setting your project's priority *After: MyBoiletPlate*... – colymba Mar 24 '14 at 11:59