Add an PNG image to the image you generated : PNG « Language Basics « PHP






Add an PNG image to the image you generated

<?php
     header("Content-type: image/png");
     $src_filename = "http://www.java2s.com/style/logo.PNG";
     $src = @ImageCreateFromPng($src_filename) or die("Could not create source image");
     $src_size = GetImageSize($src_filename);
     $im = @ImageCreate(320, 200)  or die("Could not create destination image");
   
     $bg_color = ImageColorAllocate($im, 240, 240, 240);
     $text_color = ImageColorAllocate($im, 0, 0, 0);
   
     for($i = 0; $i < 5; $i++){
          ImageCopy($im, $src, 100, $i * 25, 0, 0, $src_size[0], $src_size[1]);
     } 
     ImagePng($im);
     ImageDestroy($src);
     ImageDestroy($im);
?>

           
       








Related examples in the same category

1.Create PNG file