国产精品成人VA在线观看,亚洲日韩在线中文字幕综合,亚洲AV电影天堂男人的天堂,久久人人爽人人爽人人av东京热

News新聞

業(yè)界新聞動(dòng)態(tài)、技術(shù)前沿
Who are we?

您的位置:首頁(yè)      樂(lè)道系統(tǒng)FAQ      淺談關(guān)于PHP解決圖片無(wú)損壓縮的問(wèn)題

淺談關(guān)于PHP解決圖片無(wú)損壓縮的問(wèn)題

標(biāo)簽: 發(fā)布日期:2017-09-01 00:00:00 276

本文介紹了關(guān)于PHP解決圖片無(wú)損壓縮的問(wèn)題,分享給大家,具體如下:

代碼如下:

header("Content-type: image/jpeg"); 
$file = "111.jpg"; 
$percent = 1.5; //圖片壓縮比 
list($width, $height) = getimagesize($file); //獲取原圖尺寸 
//縮放尺寸 
$newwidth = $width * $percent; 
$newheight = $height * $percent; 
$src_im = imagecreatefromjpeg($file); 
$dst_im = imagecreatetruecolor($newwidth, $newheight); 
imagecopyresized($dst_im, $src_im, 0, 0, 0, 0, $newwidth, $newheight, $width, $height); 
imagejpeg($dst_im); //輸出壓縮后的圖片 
imagedestroy($dst_im); 
imagedestroy($src_im);