Hey im trying to make a signature generator and I have multiple images going over eachother. And when the user clicks "create signature" I want it to merge all of the selected layers into 1 png image. I know its possible but for some reason it never works for me.

I was using something like this, but all it did was create a bunch of jiberish text on my web page without actually creating the image.

PHP Code:
$image imagecreatefromstring(file_get_contents(URL OF IMAGE);
$frame imagecreatefromstring(file_get_contents(URL OF IMAGE));


Can someone help me out to get this to work please?

Also, is it possible to merge text layers to the image too? If its possible, could you include that too please?