如图所示,我写了一个脚本抓取贴吧用户头像拼接成照片墙,贴吧头像有的是jpg,有的是png。list($intWidth, $intHeight, $type, $attr) = getimagesize($strImagePath);
echo "getimagesize($strImagePath) : $intWidth, $intHeight, $type, $attr \n";
$resSourceImage = null;
switch ($type) {
case IMAGETYPE_JPEG:
$resSourceImage = imagecreatefromjpeg($strImagePath);
break;
case IMAGETYPE_PNG:
$resSourceImage = imagecreatefrompng($strImagePath);
break;
case IMAGETYPE_GIF:
$resSourceImage = imagecreatefromgif($strImagePath);
break;
default:
echo "unknown type: {$type} \n";
}
我使用如上代码进行创建画布然后使用imagecopy进行合并之后,就出现了如图所示的情况,图片颜色泛黄,这是怎么回事呢?有什么解决方法嘛?