Dynamically add text to an image

Discussion in 'PHP' started by egdcltd, Aug 25, 2006.

  1. #1
    I'm not sure if it's possible, but what I want to do is this:

    Add text on top of an image displayed. The text can't be permanently added to the image, as it will be called from a MySQL database, and will frequently alter. Also, the same image will be displayed a number of times on the same page, but with different text.

    Alternatively, display a (javascript?) popup when the pointer hovers over the image, the popup again displaying different information called from the database.

    Or maybe both, if both are possible.
     
    egdcltd, Aug 25, 2006 IP
  2. danielbruzual

    danielbruzual Active Member

    Messages:
    906
    Likes Received:
    57
    Best Answers:
    0
    Trophy Points:
    70
    #2
    A dynamic image can be easily done in php, use imagecreatefrompng() to load an existing image and then use imagestring() to write the stringt unto the image.

    [SEARCh=GOOGLE]Php Dynamic Images[/SEARCH]
    [Search=Google]Php Dynamic Sig[/SEARCH]
     
    danielbruzual, Aug 25, 2006 IP
  3. egdcltd

    egdcltd Peon

    Messages:
    691
    Likes Received:
    14
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Thanks. That looks like it might be a lot easier than I thought. Any ideas on creating a popup on hover?
     
    egdcltd, Aug 25, 2006 IP
  4. ip076

    ip076 Peon

    Messages:
    79
    Likes Received:
    5
    Best Answers:
    0
    Trophy Points:
    0
    #4
    That would take a little javascript. Something like (rough code): onmouseover=window.open(parameters).

    You would also probably want onmouseout=window.close() - I think you can specifiy which window to close here using the name you gave the window with the open command...

    Or something like that.....
     
    ip076, Aug 25, 2006 IP