SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Enthusiast
    Join Date
    Oct 2012
    Posts
    46
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)

    merging image layers using php

    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));

    imagecopymerge($image$frame00005050100);

    imagepng($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?

  2. #2
    SitePoint Mentor silver trophy
    Rubble's Avatar
    Join Date
    Dec 2005
    Location
    Cambridge, England
    Posts
    2,438
    Mentioned
    82 Post(s)
    Tagged
    3 Thread(s)
    1/ The "jiberish text " was probably the image and you had the wrong headers so it was not displaying it as an image.

    2/ I always recomend starting simple and building up - create a dedicated page with just your code and absolute paths. When that is working OK move on to getting remote files and variables etc.

    P.S. Your actual code is better than "I was using something like this".


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •