1

I'm trying to dynamically generate an image file that will be composed by other smaller images. This is the code I've got so far

    if ( function_exists('imagecreate') ) {
        header ("Content-type: image/png");
        $im = @imagecreate ($imgWidth, $imgHeight)
            or die ("Cannot initialize new GD image stream");
        $background_color = imagecolorallocate ($im, 255, 255, 255);
        $text_color = imagecolorallocate ($im, 0,0,0);
        imagepng ($im);
        imagedestroy($im);
    }

So far, it's working fine. I just can't figure out how to include my smaller images into this new, bigger, dynamically generated image. Does anyone know how to do this? Ideally, the function that does this (or whatever it is) would ask me for the image file, it's x and y positions in the second image file.

Any suggestions? I sincerely appreciate any help you can bring me. Thank you so so much!!

Sebolains
  • 752
  • 2
  • 9
  • 16
  • 3
    GD includes functions to read images from files, if that's what you're talking about. It's in the docs. :) – awm Feb 25 '11 at 14:21
  • Yeah, I found the docs for imagecopy() and was able to do it that way. Thanks!! – Sebolains Feb 25 '11 at 15:21

1 Answers1

1

Imagecopymerge is probably what you are looking for

grunk
  • 14,718
  • 15
  • 67
  • 108
  • Thanks! I ended up using imagecopy(), but I got to it thanks to your suggestion. It's working fine :) Thanks again!! – Sebolains Feb 25 '11 at 15:20