Thumbnails Not Cropped
qwerty1234 - May 2, 2006 - 00:28
| Project: | Image Exact Sizes |
| Version: | 4.7.x-1.x-dev |
| Component: | Miscellaneous |
| Category: | bug report |
| Priority: | critical |
| Assigned: | Unassigned |
| Status: | active |
Jump to:
Description
when you change the thumbnail size in settings for image module, image module automaticaly resizes the thumbs to new setting but images are not croped by this module

#1
This happens because of the line
if ($node->type == 'image' && $op == 'validate' && variable_get('image_exact_thumbs', 1)) {
When the thumbs are recreated my image.module, no nodeapi $ops are called, so image_exact never gets the chance to work on the thumbs.
#2
This is why this option should be a part of image.module. I submitted a patch yesterday but the developer deleted it. :(
#3
Marked issue 73382 as a duplicate of this issue.
#4
#5
Marked critical because without this functionality, there's nothing 'exact' about my image sizes, i.e. defeats the whole purpose of the module as I see it.
#6
Its a funny thing that when i import images one by one i have image exact make them as squared thumbnails unlike with the mass import. Is there a way to get the mass imported images to change into squared ones as well?
I made a topic here as well:
http://drupal.org/node/82874
I wasnt sure where to post so i did in 2 places
#7
Here you go guys, lets continue our chat there: http://drupal.org/node/83138
#8
We need to keep this issue open to deal with the failure of this module to crop images.
#9
I noticed two things in my module. First, I had applied a patch which stopped cropping altogether. Erroneous patch from around line 96:
function image_exact_user($op, &$edit, &$user, $category = NULL) {if ($op == 'update' && variable_get('image_exact_avatars', 0) && $edit['_account']->picture) {
list($final_w, $final_h) = explode('x', variable_get('user_picture_dimensions', '190x190'));
$w = round($final_w / 2);
$h = round($final_h / 2);
image_exact_resize( $edit['_account']->picture, $edit['_account']->picture, $w, $h);
}
}
Should be:
function image_exact_user($op, &$edit, &$user, $category = NULL) {if ($op == 'update' && variable_get('image_exact_avatars', 0) && $edit['picture']) {
list($final_w, $final_h) = explode('x', variable_get('user_picture_dimensions', '190x190'));
$w = round($final_w / 2);
$h = round($final_h / 2);
image_exact_resize( $edit['picture'], $edit['picture'], $w, $h);
}
}
And the second issue was that if the image had one of its two dimensions smaller than the requested resize dimensions, it would skip cropping altogether and simply resize/stretch the image. I think this comes from an "AND" condition for cropping in the IF statement around line 109:
if ($source_info['width'] > $final_w && $source_info['height'] > $final_h) {i.e., what if the width is greater than desired but height is not? It skips the cropping procedures (lines 117 & 124) and continues directly on to the Image Resize function around line 128.
Commenting this IF and it's end bracket has now given me actual exact sizes consistently.