embedding emails as images in webpages

Discussion in 'PHP' started by chandan123, Dec 23, 2009.

  1. #1
    chandan123, Dec 23, 2009 IP
  2. vinoth.t

    vinoth.t Peon

    Messages:
    156
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    0
    #2
    Use this code
    
    <?php
    header('Content-type: image/gif');
    ?>
    <?php
       $img=ImageCreate(300,300);
       $bgcolor=ImageColorAllocate($img,200,200,200);
       $red=ImagecolorAllocate($img,255,0,0); 
       $green=ImagecolorAllocate($img,0,255,0); 
       $blue=ImagecolorAllocate($img,0,0,255); 
       $grey=ImagecolorAllocate($img,50,50,50); 
       $black=ImagecolorAllocate($img,0,0,0); 
       ImageString($img,5,20,120,"something@domain.com",$red);
    imagepng($img);
    imagedestroy($img);
    ?>
               
    
    Code (markup):
     
    vinoth.t, Dec 23, 2009 IP
  3. ThomasTwen

    ThomasTwen Peon

    Messages:
    113
    Likes Received:
    4
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Basically, the script creating your site needs to write the email into a database with a certain id. This id is then passed on to image.php like image.php?image=123456. Image.php then uses the ID to get the eMail out of the database, and creates the image. The image creation process itself is described in the post above. Don't forget to delete the email from your database, you will not need it again.
     
    ThomasTwen, Dec 23, 2009 IP