Closed (fixed)
Project:
ImageCache
Version:
5.x-2.0-beta
Component:
Miscellaneous
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
24 Mar 2008 at 03:01 UTC
Updated:
17 Apr 2008 at 07:29 UTC
Hello.
I've been working on a upgrading a site to imagecache 2.0 beta. The crop function does not seem to work the way it did in 1.0.
I have a preset set up with two actions:
1: Scale 250 pixels wide, No height value
2: Crop 250 pixels wide, 166 pixels high, center x, center y
My source image is 1144 x 772. The scale should bring to 250x169.
In imagecache 2.0, it does produce an image 250x166, however the lower 49 pixels are all black.
Attached is the imagecache 1.0 image and the imagecache 2.0 image.
| Comment | File | Size | Author |
|---|---|---|---|
| 56_128WX_imagecache20.jpg | 9.01 KB | jsm174 | |
| 56_128WX_imagecache10.jpg | 11.31 KB | jsm174 |
Comments
Comment #1
jsm174 commentedI started to debug this and it seems like the "image" that comes out of the scale that gets feed into the crop has the wrong dimensions. I put debug messages into the scale and crop methods and the math is definitely correct.
imagecache_scale_image: image=stdClass Object ( [source] => files/potw/yuengling260lh8.jpg [info] => Array ( [width] => 640 [height] => 241 [extension] => jpg [file_size] => 68431 [mime_type] => image/jpeg ) [toolkit] => imageapi_gd [res] => Resource id #141 ) , data=Array ( [width] => 198 [height] => [upscale] => 0 )
imagecache_crop_image: image=stdClass Object ( [source] => files/potw/yuengling260lh8.jpg [info] => Array ( [width] => 198 [height] => 198 [extension] => jpg [file_size] => 68431 [mime_type] => image/jpeg ) [toolkit] => imageapi_gd [res] => Resource id #144 ) , data=Array ( [width] => 198 [height] => 132 [xoffset] => 0 [yoffset] => 33 )
-- Jason
Comment #2
jsm174 commentedSince this is my first time through the flow of image cache please bare with me.
I added some more diags.
imageapi_image_scale(): post toolkit call width=198, height=75, image=stdClass Object ( [source] => files/potw/yuengling260lh8.jpg [info] => Array ( [width] => 198 [height] => 198 [extension] => jpg [file_size] => 68431 [mime_type] => image/jpeg ) [toolkit] => imageapi_gd [res]
The image comes back with the incorrect height of 198.
I think the bug is in:
imageapi_gd_image_resize() in imageapi_gd.module:
$image->res = $res;
$image->info['width'] = $width;
$image->info['height'] = $width; <--- Should be $image->info['height'] = $height;
I will submit a patch in the ImageAPI issues queue.
-- Jason
Comment #3
jsm174 commentedNew issue and patch under ImageAPI created:
http://drupal.org/node/239898
Comment #4
dopry commentedthis was fixed in imageapi.