Sebolains
Sebolains

Reputation: 782

Insert Image file into php's imagecreate

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!!

Upvotes: 1

Views: 5553

Answers (1)

grunk
grunk

Reputation: 14938

Imagecopymerge is probably what you are looking for

Upvotes: 1

Related Questions