/*
* 將圖片等比例縮放
* dest_path 源圖片地址
*/
function imageUpdateSize( dest_path)
{
//將圖片等比例縮放
path.md5(
width, dest_path);
//縮放比例
width,3);
width *
n_h =
per;
//1.創(chuàng)建畫布
$new = imagecreatetruecolor($n_w, $n_h);
$img = imagecreatefrompng($dest_path);
//2.上色
$color=imagecolorallocate($new,255,255,255);
//3.設(shè)置透明
imagecolortransparent($new,$color);
imagefill($new,0,0,$color);
//copy部分圖像并調(diào)整
imagecopyresized($new, $img,0, 0,0, 0,$n_w, $n_h, $width, $height);
//圖像輸出新圖片、另存為
imagepng($new, $new_path);
imagedestroy($new);
imagedestroy($img);
return $new_path;
}