1
我想縮小圖像尺寸,但縮放後的圖像具有銳利的邊緣。使用抗鋸齒功能在PHP中調整圖像大小
foreach ($images as $image){
$filename=$initPath.$sku.'/'.$srcFolder.'/'.$image;
//$percent=0.5;
list($width, $height) = getimagesize($filename);
//$newwidth = $width * $percent;
//$newheight = $height * $percent;
$fh = fopen($initPath.$sku.'/'.$distFolder.'/'.$image, 'w');
fclose($fh);
$wtf= realpath($initPath.$sku.'/'.$distFolder.'/'.$image);
// загрузка
$thumb = imagecreatetruecolor(200, 200);
imagesetinterpolation($thumb,IMG_BICUBIC);
imagealphablending($thumb, false);
imagesavealpha($thumb,true);
$transparent = imagecolorallocatealpha($thumb, 255, 255, 255, 127);
$source = imagecreatefrompng($filename);
// изменение размера
imagecopyresized($thumb, $source, 0, 0, 0, 0, 200, 200, $width, $height);
// вывод
imagepng($thumb,$wtf,1);
}
原文:
如何與抗鋸齒辦呢?
這條線對我來說會引發一個錯誤,但是我想這對我的php和gd lib是正確的嗎? – tttaaabbb
你看到什麼錯誤? – Jim
致命錯誤:調用未定義的函數imageantialias() – tttaaabbb