<?
//calculate thumb size
$ow = imagesx($im);
$oh = imagesy($im);
$maxh = 100;
$maxw = 150;
$new_h = $oh;
$new_w = $ow;
if($oh > $maxh || $ow > $maxw){
$new_h = ($oh > $ow) ? $maxh : $oh*($maxw/$ow);
$new_w = $new_h/$oh*$ow;
}
//create dst image
$dst_img = ImageCreateTrueColor($new_w,$new_h);
//resize and copy image
ImageCopyResized($dst_img, $im, 0,0,0,0, $new_w, $new_h, ImageSX($im), ImageSY($im));
$function_image_new($dst_img,$galdir.$file);
?>
Create thumbnail
最新推荐文章于 2021-05-31 22:04:47 发布