小编Bas*_*nce的帖子

PNG透明度与PHP

当我从它创建缩略图时,我在尝试保持png的透明度方面遇到一些麻烦,任何人都有这方面的经验吗?任何帮助都会很棒,这就是我目前正在做的事情:

$fileName= "../js/ajaxupload/tees/".$fileName;

list($width, $height) = getimagesize($fileName);

$newwidth = 257;
$newheight = 197;

$thumb = imagecreatetruecolor($newwidth, $newheight);
imagealphablending($thumb, true);
$source = imagecreatefrompng($fileName);
imagealphablending($source, true);

imagecopyresized($thumb, $source, 0, 0, 0, 0, $newwidth, $newheight, $width, $height);

imagesavealpha($thumb, true);
imagepng($thumb,$newFilename);
Run Code Online (Sandbox Code Playgroud)

php png transparency

43
推荐指数
2
解决办法
5万
查看次数

标签 统计

php ×1

png ×1

transparency ×1