[Plugin: User Photo] Thumbnails Height
-
This plug-in calculates the height of the thumbnail according to the original image’s width and height.
So you will get different heights from each user′s photo
This is the original code
`// figure out the longest side
if ( $info[0] > $info[1] ) {
$image_width = $info[0];
$image_height = $info[1];
$image_new_width = $maxdimension;
$image_ratio = $image_width / $image_new_width;
$image_new_height = $image_height / $image_ratio;
//width is > height
} else {
$image_width = $info[0];
$image_height = $info[1];
$image_new_height = $maxdimension;
$image_ratio = $image_height / $image_new_height;
$image_new_width = $image_width / $image_ratio
//height > width
}
$imageresized = imagecreatetruecolor( $image_new_width, $image_new_height);
@ imagecopyresampled( $imageresized, $image, 0, 0, 0, 0, $image_new_width, $image_new_height, $info[0], $info[1] );
What would be nice is to have a fixed height thumb with the image centered so the Image get cropped with criteria.
Right now, i have different thumbs heights in a 120×80 box, i had to fix this by overriding its container div (overflow: hidden), so the image *is* 120*80 with no resizing, but then the image starts from the Top Left of the block, with nasty results about the position of the photo.
In my particular case, i need the thumbs to fit in a 120px.80px box, and the image composition (imagine a tree, a car and a tree, right now i have a 120/80 box with a tree and half car) so it should be centered.
any hint? thank you.
- The topic ‘[Plugin: User Photo] Thumbnails Height’ is closed to new replies.