Image

Discussion in 'PHP' started by Nerve, Sep 10, 2007.

  1. #1
    Hello.

    I am clueless on how to do something like this in PHP.

    I have a 100x50 Pixel Background Image (bg.gif).
    I have two 50x50 Pixel Thumbnails (1.gif, 2.gif).

    How do I put the two thumbnails side by side on the background image? Any help would be appreciated.
     
    Nerve, Sep 10, 2007 IP
  2. webrickco

    webrickco Active Member

    Messages:
    268
    Likes Received:
    4
    Best Answers:
    0
    Trophy Points:
    60
    #2
    This is not PHP related, but HTML only.

    try something like this:
    
    <!-- style def. -->
    .styling
    {
    	background-image: url(images/bg.gif);
    	background-repeat: no-repeat;
    	background-position: left center;
    	
    }
    
    <TABLE CLASS="styling">
    <tr height="height of BG">
    <td width="half width of bg">
    <img src="images/1.gif">
    </td>
    <td width="half width of bg">
    <img src="images/2.gif">
    </td>
    </tr>
    </table>
    
    
    HTML:
    hope this works for you.
     
    webrickco, Sep 10, 2007 IP
  3. Nerve

    Nerve Peon

    Messages:
    467
    Likes Received:
    4
    Best Answers:
    0
    Trophy Points:
    0
    #3
    I know how to do that, lol. However I want it to be one image so people can link to it. Like:

    
    <img src="finalimage.gif">
    
    Code (markup):
     
    Nerve, Sep 10, 2007 IP
  4. webrickco

    webrickco Active Member

    Messages:
    268
    Likes Received:
    4
    Best Answers:
    0
    Trophy Points:
    60
    #4
    then i misunderstood your question. could you explain better?
     
    webrickco, Sep 10, 2007 IP
  5. Nerve

    Nerve Peon

    Messages:
    467
    Likes Received:
    4
    Best Answers:
    0
    Trophy Points:
    0
    #5
    I want to combine two thumbnails (50x50px) and put them side by side, in PHP.
     
    Nerve, Sep 11, 2007 IP
  6. webrickco

    webrickco Active Member

    Messages:
    268
    Likes Received:
    4
    Best Answers:
    0
    Trophy Points:
    60
    #6
    Would you care to try something like:
    
    // fusioned image
    $bg = imageCreateFromGIF("bg.gif");
    // the 2 thumbs
    $Img1 = imageCreateFromGIF("1.GIF");
    $Img2 = imageCreateFromGIF("2.GIF");
    //copy side by side
    imageCopyMerge($bg, $Img1, 0, 0, 0, 0, 50, 50, 0);
    imageCopyMerge($bg, $Img2, 51, 0, 0, 0, 50, 50, 0);
    //save the new image
    header("Content-type: image/jpg");
    ImageJPEG($bg,"",100);
    
    PHP:
    I did no try it but in theory this should do the job. Give me some feedback.
     
    webrickco, Sep 11, 2007 IP