How to create image in php
<p>I am creating image with php</p>

<p>code</p>

<pre><code>$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&lt;$length;$j++)
                {
                $value.=$char{mt_rand(0,$max_i)};
                }
                $imageid=$value;
</code></pre>

<p>it giving error on page like </p>

<blockquote>
  <p>‰PNG  IHDR#ÒOuî² CIDATxœíÖ]ŒdÇUðÿ9§êÞþ˜™]ïìÇlbc‚ÀÐ†(@dQž
  @"$ƒ”&lt;°E‚XX<code>Y~ E D¼€"!ÂI’;Q$£°M¼ïzw½_3ÓÓÝ÷Ö×9&lt;ôÌ¬óÄ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¼Ž'&gt;ô»ÇýÚ‘áÊòêÒh8Hëá¬
  Œ,eïÄ9îK ¡Lº½4ëºÙüÖ7Óä¿ø—Ø–€‡(™€b’
  »øØ¹ß\K÷o¾ãÌúI&amp;*‚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&gt;ûØ
  x</code>°"*¶ñ±|äÄÚ™ñÊ±Év§Á4X‰¶·Óõ†S‹½€½Ž£QFècÅcŒ¡OH
  ˆ²ÝË¤Ï·ws›ë›'è$þûòþ:931þkû¸-Z;1Ÿv%ôÐ’c
  ß¸&amp;Lûaëgq:Ó>Í•àÃñ`¼:;EŠÉHBL­¸ºv&lt;š¤É€†§†Ç¿õ¥¯ŸýÉì');¾óÂ·7ëÜ'
  9ö¥ˆH\C–Çäß¼ùæ%Ýž #µs­¦áéptU–}±lST°F:£#úÃ£Ï}ù«g?HÊ Q&lt;÷¥=5>–»b¢M¹uV 
  †½8»&lt;»úûŸ{ooa€xmïÓ|üÈÚÀ›Ï}/</p>
</blockquote>

<p>how i can solve this </p>
