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've moved the forum!

Please use forum.silverstripe.org for any new questions (announcement).
The forum archive will stick around, but will be read only.

You can also use our Slack channel or StackOverflow to ask for help.
Check out our community overview for more options to contribute.

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   2737 Views

Avatar
superautomatic

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: http://gvac2.web.pin.se/troll-c/

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

regards,

/Jens

Avatar
jam13

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 :).

Avatar
superautomatic

Community Member, 53 Posts

23 January 2008 at 3:11am

Edited: 20/06/2008 11:38pm

Thanks for the quick answer. Worked perfectly.