我正在用 php 创建图像
代码
$src = array ("22.jpg","33.jpg","44.jpg","55.jpg","66.jpg","77.jpg");
$imgBuf = array ();
foreach ($src as $link)
{
switch(substr ($link,strrpos ($link,".")+1))
{
case 'png':
$iTmp = imagecreatefrompng($link);
break;
case 'gif':
$iTmp = imagecreatefromgif($link);
break;
case 'jpeg':
case 'jpg':
$iTmp = imagecreatefromjpeg($link);
break;
}
array_push ($imgBuf,$iTmp);
}
$iOut = imagecreatetruecolor ("35","210") ;
imagecopy ($iOut,$imgBuf[0],0,0,0,0,imagesx($imgBuf[0]),imagesy($imgBuf[0]));
imagedestroy ($imgBuf[0]);
imagecopy ($iOut,$imgBuf[1],0,35,0,0,imagesx($imgBuf[1]),imagesy($imgBuf[1]));
imagedestroy ($imgBuf[1]);
imagecopy ($iOut,$imgBuf[2],0,70,0,0,imagesx($imgBuf[2]),imagesy($imgBuf[2]));
imagedestroy ($imgBuf[2]);
imagecopy ($iOut,$imgBuf[3],0,105,0,0,imagesx($imgBuf[3]),imagesy($imgBuf[3]));
imagedestroy ($imgBuf[3]);
imagecopy ($iOut,$imgBuf[4],0,140,0,0,imagesx($imgBuf[4]),imagesy($imgBuf[4]));
imagedestroy ($imgBuf[4]);
imagecopy ($iOut,$imgBuf[5],0,175,0,0,imagesx($imgBuf[5]),imagesy($imgBuf[5]));
imagedestroy ($imgBuf[5]);
imagepng($iOut);
//header ( 'Content-type:image/png' );
// save the img to directory
$char='0123456789';
$length=10;
$max_i=strlen($char)-1;
$value='';
for($j=0;$j<$length;$j++)
{
$value.=$char{mt_rand(0,$max_i)};
}
$imageid=$value;
它在页面上给出错误
‰PNG IHDR#ÒOuî² CIDATxœíÖ]ŒdÇUðÿ9§êÞþ˜™]ïìÇlbc,ÀІ(@dQž @"$ƒ"<°E,XX
Y~ E D¼€"!ÂI’;Q$£°M¼ïzw½_3ÓÓÝ÷Ö×9<ô̬óÄRê§V«Õ·»ÿU]uÏ)JÙ ‚Ì€˜7€wâÕ½«¯^»Óçþå™åfȹ-š© *6›çŸù¹÷ðêðÌ[í‰%üÈ]؆0‡8@@ÙL3¼Än‘×ãÞ«·žxôñ»×69àôú©e?ÊóÙÊx™’W+Ü”˜C1Vö4Üîowq÷zwë?ýI·u§,É~@½™@PF¼Ž'>ô»ÇýÚ‘áÊòêÒh8HëᬠŒ,eïÄ9îK ¡Lº½4ëºÙüÖ7Óä¿ø—Ø–€‡(™€b’ »øعß\K÷o¾ãÌúI&*‚lÙÁR4P£ÄEÕ‰P¢ó!Î}ë:ëEdÄ-gX_.߸òòök¯ûŸúöߣMp~1'ç($àßo½-ÿÀÛï][Z/1Ëlo‡PaÕa#¥›{4Óɘ4—\Š9í%©FË'7ÓÕñÝîƒÅ_h¹@øNþÄû}ðØ?6NsLªêü0ö¡q%ö#fÖ2²Óbð’´¨ªjS¸,¾GE.ì\x~÷ùO>ûØ x
°"*¶ñ±|äÄÚ™ñʱÉv§Á4X‰¶·Óõ† S‹½€½Ž£QFècÅcŒ¡OH ˆ²ÝˤϷws›ë›'è$þûòþ:931þkû¸-Z;1Ÿv%ôÐ'c ߸&Lûaëgq:Ó>Í•àÃñ`¼:;EŠÉHBL¸ºv<š ¤É€†§†Ç¿õ¥¯ŸýÉì');¾ó·7ëÜ' 9ö¥^H\C–Çäß¼ùæ%Ýž #µs¦áéptU–}±lST°F:£#úãÏ}ù«g?HÊ Q<÷¥=5>–»b¢M¹uV †½8»<»úûŸ{ooa€xmïÓ|üÈÚÀ›Ï}/
我怎么能解决这个问题