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?

Comments

mcurry’s picture

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

mcurry’s picture

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
Assigned: Unassigned » mcurry
Category: support » feature
Status: Active » Needs review
StatusFileSize
new1.12 KB

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.

kbahey’s picture

Status: Needs review » Fixed

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

Should be in the download in 24 hours.

Thank you.

mcurry’s picture

Status: Fixed » Needs review
StatusFileSize
new617 bytes

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


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

kbahey’s picture

Status: Needs review » Fixed

Committed. Wait for 24 hours for the new tarball.

Anonymous’s picture

Status: Fixed » Closed (fixed)

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