2

好吧,因为我没有进入 PHP 中的 GD Libary 和 Image 函数,所以我有点卡住了……事实上,从上传的文件创建 JPEG 图像时,相同的函数没有问题 - 但它卡在 png 上……所有我得到的是一个具有正确文件名和目标的 33 字节文件 - 当然原始图像存在并且上传得很好......

$altesBild=ImageCreateFromPNG("$PicPathIn"."$bild"); 
$neuesBild=imagecreatetruecolor(300,$neueHoehe);
$neuesBildHeader=imagecreatetruecolor(966,$neueHoeheHeader);  
imagecopyresampled($neuesBild,$altesBild,0,0,0,0,300,$neueHoehe,$breite,$hoehe);
imagecopyresampled($neuesBildHeader,$altesBild,0,0,0,0,966,$neueHoeheHeader,$breite,$hoehe);
ImagePNG($neuesBild,"$PicPathOut"."/thumbs/thumb_"."$bild",80);
ImagePNG($neuesBildHeader,"$PicPathOut"."/header/header_"."$bild",80);
4

2 回答 2

4

尝试使用 0 到 9 之间的压缩值,如函数文档中所述ImagePNG

于 2012-06-03T07:30:17.097 回答
1

未定义用于压缩的 80 值:这是您的代码的更新

$altesBild=ImageCreateFromPNG("$PicPathIn"."$bild"); 
$neuesBild=imagecreatetruecolor(300,$neueHoehe);
$neuesBildHeader=imagecreatetruecolor(966,$neueHoeheHeader);  
imagecopyresampled($neuesBild,$altesBild,0,0,0,0,300,$neueHoehe,$breite,$hoehe);
imagecopyresampled($neuesBildHeader,$altesBild,0,0,0,0,966,$neueHoeheHeader,$breite,$hoehe);
ImagePNG($neuesBild,"$PicPathOut"."/thumbs/thumb_"."$bild",8);
ImagePNG($neuesBildHeader,"$PicPathOut"."/header/header_"."$bild",8);

这应该可以完成这项工作。

于 2012-06-03T07:39:59.890 回答