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: [Dave] Quality of resized images?

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

Hi Dave,

Thanks for the welcome! Appreciate your comment about my templates. I've got a bunch more to post but I'm waiting until I complete my site redesign using CMS Builder [;)]

Here's a sample of the images I uploaded. You'll see the distortion around the edge of the cards (especially on the thumbnail). The original image was crystal clear. On some of the other gallery scripts I've used you could adjust the JPG compression/quality. I realize the higher the quality, the larger the file size. So it's always a trade-off. For some applications, like photoblogs, you might want higher quality jpgs. I was playing with the gallery feature. It's really neat.

Note: I removed the sample images since the problem has been fixed.
Darren Hester
www.designsbydarren.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