php简单生成缩略图 无 function img_create_small($big_img, $width, $height, $small_img) {//原始大图地址,缩略图宽度,高度,缩略图地址$imgage = getimagesize($big_img); //得到原始大图片switch ($imgage[2]) { // 图像类型判断case 1:$im = imagecrea
php简单生成缩略图 function img_create_small($big_img, $width, $height, $small_img) {//原始大图地址,缩略图宽度,高度,缩略图地址$imgage = getimagesize($big_img); //得到原始大图片switch ($imgage[2]) { // 图像类型判断case 1:$im = imagecreatefromgif($big_img);break;case 2:$im = imagecreatefromjpeg($big_img);break;case 3:$im = imagecreatefrompng($big_img);break;}$src_w = $imgage[0]; //获取大图片宽度$src_h = $imgage[1]; //获取大图片高度$tn = imagecreatetruecolor($width, $height); //创建缩略图imagecopyresampled($tn, $im, 0, 0, 0, 0, $width, $height, $src_w, $src_h); //复制图像并改变大小imagejpeg($tn, $small_img); //输出图像}