Я использую такой код (может пригодится)
CODE:function create_tmb($bigimgsrc,$trumbalis){
$quality = 100;
$width = 148;
$height = 118;
$size = @getimagesize($bigimgsrc);
$format = strtolower(substr($size['mime'], strpos($size['mime'], '/')+1));
$icfunc = "imagecreatefrom" . $format;
if (!function_exists($icfunc)) return false;
$x_gut = 0;
$y_gut = 0;
$x_proporcia = $size[0]/$width;
$y_proporcia = $size[1]/$height;
$actual_height = (($x_proporcia*$height) < $size[1]) ? $x_proporcia*$height : $size[1];
$actual_width = (($y_proporcia*$width) < $size[0]) ? $y_proporcia*$width : $size[0];
$bigimg = $icfunc($bigimgsrc);
$trumbcreate = imagecreatetruecolor($width, $height);
imagecopyresampled($trumbcreate, $bigimg, 0, 0, 0, 0, $width, $height, $actual_width, $actual_height);
imagejpeg($trumbcreate,$trumbalis,$quality);
flush();
imagedestroy($bigimg);
imagedestroy($trumbcreate);
return true;
} |