In-Portal Issue Tracker - In-Portal CMS
Viewing Issue Advanced Details
458 [In-Portal CMS] Data Management bug report always 2009-12-18 11:50 2010-05-11 03:00
alex  
alex  
normal  
closed 5.0.1  
fixed  
 
none 5.0.3-B1  
http://groups.google.com/group/in-portal-bugs/browse_thread/thread/bf6e35355c3d5691?hl=en
0
0000458: Scale image quality setting is incorrect for PNG images
In ImageHelper we have method called ScaleImage. In the end of process
it does, it saves image with functions such as imagejpeg, imagepng,
imagegif, etc. These functions take quality parameter, and we pass
hardcoded quality value = 100. But imagepng function may have only 0-9
value range, and if quality is not in this range, it saves broken
image file. So resize/watermarking never worked for png images.

Note: png quality parameter values are reversed related to jpeg: 0
means no compression, and 9 means highest possible compression.

I think we need to investigate about other image saving functions,
what quality values they take.

Also, as improvement, we may add configuration value for resized image
quality, so site administrator will be able to control size-quality
balance.
We use 100 as image quality for resized images. This is not always true, see
image function description above:

   - imagejpeg - 100;
   - imagegif - doesn't have quality parameter at all;
   - imagepng - 9.

That's why all resized PNG images are broken in result (just black). Maybe
value of 100 at least worked some how before PHP 5.2 or maybe we were not
using PNG images a lot in our projects.
patch png_image_resize_fix.patch (738) 2009-12-19 04:40
http://tracker.in-portal.org/file_download.php?file_id=165&type=bug
patch wrong_compression_setting_for_imagepng.patch (512) 2010-03-14 06:22
http://tracker.in-portal.org/file_download.php?file_id=353&type=bug
Issue History
2010-05-11 03:00 alex Note Added: 0002155
2010-05-11 03:00 alex Status resolved => closed
2010-03-14 06:27 alex Note Added: 0001593
2010-03-14 06:26 alex Changeset attached 5.0.x r13213
2010-03-14 06:22 alex File Added: wrong_compression_setting_for_imagepng.patch
2010-03-11 09:01 alex Note Added: 0001556
2010-03-11 09:01 alex Status reviewed and tested => resolved
2010-03-11 09:01 alex Fixed in Version => 5.0.3-B1
2010-03-11 09:01 alex Resolution open => fixed
2010-03-11 09:01 alex Changeset attached 5.0.x r13201
2010-02-26 16:52 Dmitry Developer => alex
2010-02-21 17:57 Dmitry Note Added: 0001481
2010-02-21 17:57 Dmitry Assigned To !COMMUNITY => alex
2010-02-21 17:57 Dmitry Status needs testing => reviewed and tested
2010-01-06 06:22 alex Target Version Icebox => 5.0.3
2009-12-19 04:40 alex Assigned To => !COMMUNITY
2009-12-19 04:40 alex Status active => needs testing
2009-12-19 04:40 alex File Added: png_image_resize_fix.patch
2009-12-18 11:51 alex Target Version => Icebox
2009-12-18 11:50 alex New Issue
2009-12-18 11:50 alex Reference => http://groups.google.com/group/in-portal-bugs/browse_thread/thread/bf6e35355c3d5691?hl=en

Notes
(0001481)
Dmitry   
2010-02-21 17:57   
Review and Tested Okay.
(0001556)
alex   
2010-03-11 09:01   
Fix committed to 5.0.x branch. Commit Message:

Fixes 0000458: Scale image quality setting is incorrect for PNG images
(0001593)
alex   
2010-03-14 06:27   
About "wrong_compression_setting_for_imagepng.patch" patch:

Function "imagepng" has "compression" as 2nd parameter, but "imagejpg" has "quality" as 2nd parameter. That lead to imagepng being given worst quality setting in result.
(0002155)
alex   
2010-05-11 03:00   
Closing all tasks from released versions.