Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

We're retiring the forums!

The SilverStripe forums have passed their heyday. They'll stick around, but will be read only. We'd encourage you to get involved in the community via the following channels instead:

Archive /

Our old forums are still available as a read-only archive.

Moderators: martimiz, Sean, Ed, biapar, Willr, Ingo

Auto-resized images - quality?

Go to End

3 Posts   2644 Views


Community Member, 53 Posts

23 January 2008 at 12:27am

Edited: 23/01/2008 12:28am

When using the .SetWidth() function on images from a template, is there any way to control the resampling quality? It seems to me that the resampled image is kind of blurred.

Here's an example:

(click the image to see the original version of the image)




121 Posts

23 January 2008 at 12:57am

There are two ways of fixing this that I know of at the moment:

1) Edit sapphire/filesystem/GD.php and change the default quality from 75 to something higher (I find 90 works well). This will change the default quality for _all_ processed images. Of course this will get changed back when you upgrade SS.

2) Extend or decorate the Image class and use the setQuality method to change the quality of generated images. If you're inserting images into the content area of a page then you will need to decorate the Image class, while if you doing a relationship then can just extend it.

It would be much nicer to have an easier way of setting the quality though, even if it was just a constant in _config.php, as this is the most common complaint we have received from our customers.

Of course there may already be an easy way of doing this, but if there is then it's certainly well hidden :).


Community Member, 53 Posts

23 January 2008 at 3:11am

Edited: 20/06/2008 11:38pm

Thanks for the quick answer. Worked perfectly.