Quality of resized images?

7 posts by 2 authors in: Forums > CMS Builder
Last Post: February 1, 2008   (RSS)

By DHester - January 18, 2008

Hello,

Just purchased a copy of CMS Builder yesterday. So far I'm very impressed. No problems installing. Still playing around with all the options [;)] One feature that I like is the multiple image upload (image gallery) field. I was wondering how I could improve the JPG quality of the resized images. They aren't terrible but I would like to boost the quality a bit. Could you tell me if this is possible and if so, where would I make the change in the code.

Thanks!
Darren Hester
www.designsbydarren.com

Re: [DHester] Quality of resized images?

By Dave - January 18, 2008

Hi Darren,

Welcome aboard! I had a look at your site. Nice templates! I like them.

I haven't noticed any quality issues with the resizing. Could you attach the source and resized images so I can see what you mean?

We're just using the standard PHP imagecreatetruecolor and imagecopyresampled functions to do the resizing. If there's some other function or setting that can be tweaked to improve the quality - we'd certainly be open to doing that.

If you could post some examples we'll have a look and see what the problem is.
Dave Edis - Senior Developer
interactivetools.com

Re: [DHester] Quality of resized images?

By Dave - January 19, 2008

Ahh, I see. Ok, I found it. The PHP imagejpeg function takes a 3rd parameter for quality.

I've added having a quality setting to the feature list for an upcoming release. In the meantime, if you want to test it you can try editing the code in /lib/menus/default/upload_functions.php

Search for "imagejpeg" and replace this line:

case IMAGETYPE_JPEG: $savedFile = imagejpeg($targetImage, $targetPath); break;

with this line:

case IMAGETYPE_JPEG: $savedFile = imagejpeg($targetImage, $targetPath, 100); break;

Let me know if that does the trick.
Dave Edis - Senior Developer
interactivetools.com

Re: [Dave] Quality of resized images?

By DHester - January 19, 2008 - edited: January 19, 2008

Thanks Dave! Worked great [;)] Appreciate your help.

Here's a new demo page showing images resize at the higher JPG quality. Big difference:

http://www.designsbydarren.com/test/blogPage.php?Sample_Image_Gallery_Created_Using_CMS_Builder-6/
Darren Hester
www.designsbydarren.com

Re: [DHester] Quality of resized images?

By Dave - January 19, 2008

Wow, that is a big difference, thanks for pointing that out.
Dave Edis - Senior Developer
interactivetools.com

Re: [DHester] Quality of resized images?

By Dave - February 1, 2008

Just a heads up, this setting has been added to the Admin Menu (under General > Advanced Settings) for the next release (v1.10). So no more having to adjust it in the code. :)
Dave Edis - Senior Developer
interactivetools.com