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

inactivist - July 8, 2008 - 15:09

Does anybody have any information on this, or a way to fix it?

#2

inactivist - July 8, 2008 - 15:58
Title:Does watermark module respect the image toolkit quality settings?» Watermark module doesn't respect system's image_jpeg_quality settings
Version:5.x-1.0» 5.x-1.x-dev
Category:support request» feature request
Assigned to:Anonymous» inactivist
Status:active» patch (code needs review)

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.

AttachmentSize
watermark.module.patch1.12 KB

#3

kbahey - July 10, 2008 - 00:17
Status:patch (code needs review)» fixed

Applied to 5.x-1.x-dev.

Should be in the download in 24 hours.

Thank you.

#4

inactivist - July 10, 2008 - 04:57
Status:fixed» patch (code needs review)

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

<?php
function _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...

AttachmentSize
watermark.module-corrected.patch617 bytes

#5

kbahey - July 10, 2008 - 16:30
Status:patch (code needs review)» fixed

Committed. Wait for 24 hours for the new tarball.

#6

Anonymous (not verified) - July 31, 2008 - 04:46
Status:fixed» closed

Automatically closed -- issue fixed for two weeks with no activity.

 
 

Drupal is a registered trademark of Dries Buytaert.