Watermark module doesn't respect system's image_jpeg_quality settings
inactivist - May 18, 2008 - 20:45
| Project: | Image watermark |
| Version: | 5.x-1.x-dev |
| Component: | Miscellaneous |
| Category: | feature request |
| Priority: | normal |
| Assigned: | inactivist |
| Status: | closed |
Description
When saving images with the watermark, it seems that the image quality settings are not applied (the default value appears to be used.)
Is there a way to ensure that the image quality settings are applied, or will this require code modifications?

#1
Does anybody have any information on this, or a way to fix it?
#2
Here's a patch that makes the image watermark module respect the system's image_jpeg_quality settings (default is 80, I use 85% on my sites).
This makes a big difference in the quality of the watermarked images if you aren't using the default quality levels.
Patch generated against the DRUPAL-5 dev sources as of today.
#3
Applied to 5.x-1.x-dev.
Should be in the download in 24 hours.
Thank you.
#4
I've reopened this because the original patch had a typo for non-jpeg images - the else clause invoked an undefined function named $img_create_fucn rather than $img_create_func due to a typographical error.
The result of the incorrect patch is that the code will fail in a bad way on non-jpeg images...
<?phpfunction _watermark_create_image($im, $image_path, $img_create_func) {
if ($img_create_func == 'imagejpeg')
return $img_create_func($im, $image_path, variable_get('image_jpeg_quality', 80));
else
return $img_create_fucn($im, $image_path);
}
?>
The attached patch (watermark.module-corrected.patch) is rolled against the recent commit, which has the error.
Also, should the default image_jpeg_quality be something other than 80? Not sure...
#5
Committed. Wait for 24 hours for the new tarball.
#6
Automatically closed -- issue fixed for two weeks with no activity.