- 論壇徽章:
- 0
|
function resizejpg($imgsrc,$imgdst,$imgwidth,$imgheight){ //$imgsrc jpg格式圖像路徑 $imgdst jpg格式圖像保存文件名 $imgwidth要改變的寬度 $imgheight要改變的高度
$imgsrc=$imgsrc;
$arr=getimagesize($imgsrc); //取得圖片的寬度,高度值
//header("Content-type: image/jpg");
$imgWidth=$imgwidth;
$imgHeight=$imgheight;
// Create image and define colors
$imgsrc=imagecreatefromjpeg( $imgsrc);
$image=imagecreatetruecolor($imgWidth, $imgHeight); //創(chuàng)建一個彩色的底圖
imagecopyresampled ( $image, $imgsrc, 0, 0, 0, 0,$imgWidth,$imgHeight,$arr[0], $arr[1]);
imagepng($image,$imgdst);
imagedestroy($image);
}
本文來自ChinaUnix博客,如果查看原文請點:http://blog.chinaunix.net/u/4199/showart_51371.html |
|