btw. Is there a simple way to resize the thumbs according to their format? that means not only a width and heigth satatment. I'm seeking for a solution for landscape and portrait orientation.
To answer my own question:
Yes, there is a very simple way...
If you want to see a demo, look here:
http://galerie.blondl.netIn the first posting of this thread v@no made a step 3, were he altered
includes/functions.php.If you insert this code below, instead of v@nos code, you will get the thumbs recalculate, not resized, and with correct orietation.
This code is not invented by me, its v@nos code from an other file inserted here with two or three lines added.
Here is the code:
$cat_image = "";
$cat_image_id = 0;
if ($cat_cache[$category_id]['cat_image'])
{
$sql = "SELECT image_id, image_media_file, image_thumb_file, cat_id
FROM ".IMAGES_TABLE."
WHERE image_id = ".$cat_cache[$category_id]['cat_image'];
if ($image_row = $site_db->query_firstrow($sql))
{
if (!get_file_path($image_row['image_thumb_file'], "thumb", $image_row['cat_id'], 0, 0))
{
$cat_image = ICON_PATH."/".get_file_extension($image_row['image_media_file']).".gif";
}
else
{
$cat_image = get_file_path($image_row['image_thumb_file'], "thumb", $image_row['cat_id'], 0, 1);
$cat_image_id = $image_row['image_id'];
}
$file_info = @getimagesize($cat_image);
$dim = 50;
$width = $file_info[0];
$height = $file_info[1];
if ($width && $height) {
if ($width > $dim || $height > $dim) {
@$ratio = $width / $height;
if ($ratio > 1) {
$new_width = $dim;
$new_height = round(($dim/$width) * $height);
}else {
$new_width = round(($dim/$height) * $width);
$new_height = $dim;
}
}else{
$new_width = $width;
$new_height = $height;
}
}else{
$new_width = $dim;
$new_height = $dim;
}
$cat_image = "<a href=\"".$site_sess->url(ROOT_PATH."details.php?image_id=".$cat_image_id)."\" target=\"_blank\"><img src=\"".$cat_image."\" width=\"".$new_width."\" height=\"".$new_height."\"></a> ";
}
}
$site_template->register_vars("cat_image", $cat_image);
@v@no:
feel free to add this mod of your mod if you want.