PHP Image functions -- help

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Hemanth

    #1

    PHP Image functions -- help

    Hello,

    Could anyone throw some light on the following questions, please?

    1) How can I add a hyperlink to an image file generated using GD
    library?
    For eg., I'm using ImageString(... ) function to add text to a JPEG
    image. I want to make that text an hyperlink.

    2) How do I insert another gif/jpeg image into an image generated using
    GD library?
    For eg., I've the following code......I want to include "test.gif" into
    the generated JPEG (something like <img src=''> in html)

    header("Content-Type: image/jpeg");
    $c = ImageCreate($cw , $ch);
    :
    :
    ImageFilledRect angle(....)
    ImageRectangle( ....)
    ImageString(... .)
    :
    :
    ImageJPEG($c);


    TIA,
    Hemanth

  • NC

    #2
    Re: PHP Image functions -- help

    Hemanth wrote:[color=blue]
    >
    > Could anyone throw some light on the following questions, please?
    >
    > 1) How can I add a hyperlink to an image file generated using GD
    > library?
    > For eg., I'm using ImageString(... ) function to add text to a JPEG
    > image. I want to make that text an hyperlink.[/color]

    You can't. What you can do is to figure out what area of the image the
    text occupies and define that area as a hyperlink using an image map
    (image maps are defined in HTML). But you will have to do it OUTSIDE
    the script that generates the image.
    [color=blue]
    > 2) How do I insert another gif/jpeg image into an image generated
    > using GD library?[/color]

    1. Create a new image with imagecreate().
    2. Read the existing gif/jpeg image using imagecreatefrom gif()/
    imagecreatefrom jpeg().
    3. Copy that image into the one you are working on using
    imagecopy().
    4. Output the new image.

    For more information, refer to the PHP Manual:






    Cheers,
    NC

    Comment

    Working...