This topic is locked

Thumbnail by width only

1/24/2011 10:58:30 AM
PHPRunner General questions
S
STEVEBRETT author

Is it possible to modify the image resizing function so that it re-sizes based on the width only, as opposed to the greater of the height or width as it functions by default.
thanks
Steve

Sergey Kornilov admin 1/24/2011

You will have to modify CreateThumbnail fucntion in include/phpfunctions.php file.
Here is the code snippet that calculates thumbnail width and height

if($width_old>$size || $height_old>$size){

if($width_old>=$height_old)

{

$final_height=(integer)($height_old*$size/$width_old);

$final_width=$size;

}

else

{

$final_width=(integer)($width_old*$size/$height_old);

$final_height=$size;

}