Active
Project:
ImageAPI
Version:
6.x-1.x-dev
Component:
Code
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Anonymous (not verified)
Created:
6 Oct 2009 at 09:01 UTC
Updated:
8 Sep 2017 at 10:10 UTC
Using ImageCache, I can scale to 100x100 and then crop to 100x100 with settings Center:Center for the x and y offsets. This center/center option can be achieved in ImageMagick with the -gravity Center command line option.
but the function imageapi_imagemagick_image_crop doesnt have this -gravity option, so the imagecache x/y offset settings are not added to the command line.
I suggest the function should be changed to something more like this (not $gravity)
function imageapi_imagemagick_image_crop(&$image, $x, $y, $width, $height, $gravity) {
$image->ops[] = '-gravity '.$gravity.' -crop '. (int) $width .'x'. (int) $height .'+'. (int) $x .'+'. (int) $y .'!';
$image->info['width'] = $width;
$image->info['height'] = $height;
return TRUE;
}
This way, ImageCache could add the correct gravity, e.g. Center, South, Southwest etc. The GD module does have this implemented. Seems "forgotten" in the ImageMagick module.