PHP图片等比例缩放生成缩略图函数分享
代码如下: /* *@im //需要缩放的图片资源 *@filetype //制作的缩略图文件类型 *@dstimW //缩放的图片的宽度 *@dstimH //缩放的图片的高度 *@thumbname //缩略图文件名字 function makethumb($im,$dstimW,$dstimH,$thumbname,$filetype){ //获取im的宽度和高度 $pic_W=imagesx($im); $pic_H=imagesy($im); $arr = array(); swith($filetype){ case 'jpg': $arr[$filetype]="imagejpeg"; break; case 'png'; $arr[$filetype]="imagepng"; break; case 'jif'; $arr[$filetype]="imagegif"; } if(($dstimgW && $dstimgW<$pic_W) || ($dstimgH && $dstimgH<$pic_H) ){ if($dstimgW && $dstimgW<$pic_W){ $dsimgWratio = $dstimgW / $pic_w; $resizereagW =true; } $arr[$filetype]($dst,$thumbname.".$filetype"); (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |