+ Reply to Thread
Results 1 to 5 of 5

Thread: [PHP] [GD] Creating A Dynamic Signature

  1. #1
    diabolo's Avatar
    diabolo is offline Community Advocate diabolo is on a distinguished road
    Join Date
    Nov 2007
    Location
    Jersey Shore
    Posts
    1,683

    [PHP] [GD] Creating A Dynamic Signature

    I have been looking around the internet when I first started making these, and I really never could find a good one that was easy for the beginner.
    Here are a few good ones I have found:
    http://libraryofmike.org/php/creatin...th-php-and-gd/
    http://www.papaface.com/blog/2008/01...dynamic-image/
    And of course if you are gonna use PHP, why not ask the makers of it : http://us2.php.net/image
    libraryofmike is the best one that I have found so far, it gets to the basic, so you can progress from there.

    I am not going to go into big detail here since it would be a lot to cover, but I'll go over the basics.

    --------------------------------------------------------------------
    we start with the variable that we are going to call this image, lets say
    PHP Code:
    $image 
    from there we can either call in another picture that we will superimpose onto, or make a new one
    PHP Code:
    //New One
    $image imagecreatetruecolor(200200);
         
    //(w x h)
    //Call in another picture
    $image imagecreatefrompng("picture.png");
         
    //imagecreatefrompng, can be switch to jpg, gif, and some other check PHP.NET for others 
    For colors GD does not allow us to use Hexadecimal values, so we have to convert them to RGB, http://www.kenjikojima.com/java/RGBHexConverter2.html
    I like to place my colors in a variable so it is easier to reference than placing imagecolorallocate($image, 255, 255, 255); for white
    PHP Code:
    $white imagecolorallocate($image255255255); 
    for the font, I also like to refer to them as a variable, but make sure you have the correct directory, otherwise it doesn't work
    PHP Code:
    $font  'yourfont.ttf'
    now for the fun part, adding in text
    we will use the imagettftext fuction, the syntax is as follows:
    PHP Code:
    imagettftext(imagesizeanglexycolorfont"text");
    //image - the image you are to draw on
    //size - the size of the text (points)
    //angle - what angle you would like the text to display at
    //x - x-coordinate
    //y - y-coordinate
    //color - the color you would like the text to be (this case $white)
    //font - the font you would like the text to be (this case $font)
    //text - the text you would like to display 
    now after all that is settled, we need to tell the browser to display this as a png, rather than php; or any other picture file
    PHP Code:
    header("Content-type: image/png");
    //tells the browser it is a png picture
    imagepng($image);
    //displays the png image "image"
    imagedestroy($image);
    //removes the image from memory 
    hope it is easier for you guys to understand

  2. #2
    satheesh's Avatar
    satheesh is offline x10 Elder satheesh is an unknown quantity at this point
    Join Date
    Sep 2007
    Location
    Tamil Nadu,India
    Posts
    883

    Re: [PHP] [GD] Creating A Dynamic Signature

    Nice.
    I want to buy Some Scripts So Please Click This link:http://affiliate.tufat.com/index.php?id=4384
    Please rate my site:Click here




  3. #3
    diabolo's Avatar
    diabolo is offline Community Advocate diabolo is on a distinguished road
    Join Date
    Nov 2007
    Location
    Jersey Shore
    Posts
    1,683

    Re: [PHP] [GD] Creating A Dynamic Signature

    thanks

  4. #4
    Jesse's Avatar
    Jesse is offline Lord Of The Keys Jesse is an unknown quantity at this point
    Join Date
    Oct 2007
    Location
    Manila, PH
    Posts
    1,356

    Re: [PHP] [GD] Creating A Dynamic Signature

    Thanks.
    x10HOSTING
    Member Since October 2007.

    Personal Website
    | iMusicz.net

  5. #5
    sunils's Avatar
    sunils is offline x10 Spammer sunils is an unknown quantity at this point
    Join Date
    Jan 2008
    Location
    Chennai ,India
    Posts
    2,264

    Re: [PHP] [GD] Creating A Dynamic Signature

    This is a nice tutorial. Even i have a dynamic signature
    [LEFT][B]Sunil Sankar
    -------------------------------------------------------------------------

+ Reply to Thread

Similar Threads

  1. [OFF] Rent out Signature Space!
    By ikki() in forum The Marketplace
    Replies: 3
    Last Post: 10-04-2006, 05:18 PM
  2. [PHP] Dynamic Includes Tutorial
    By Bryon in forum Tutorials
    Replies: 3
    Last Post: 12-16-2005, 02:34 PM
  3. [PHP] Creating a File Upload Script
    By o0slowpaul0o in forum Tutorials
    Replies: 17
    Last Post: 10-05-2005, 02:39 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
x10hosting free hosting for the masses
dedicated servers