text image maker

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    text image maker

    heres a lil script i made a few weeks ago it lets u create images from text in url theres a few parameters which are

    color=COLOR
    size=FONT SIZE
    text=TEXT

    also $font_file replace wif the font u want you'll most likely have to upload the font file for it to work

    an example of using this code is
    (%20 is a space in url)
    color=FF0000&size=40&text=this%20is%20a%20test%20i mage

    PHP Code:
    <?php
    header
    ("Content-type: image/gif");
    //img.php
    $hex_color $_GET['color']?$_GET['color']:"000000";
    $r_txt hexdec(substr($hex_color,0,2)); 
    $g_txt hexdec(substr($hex_color,2,2)); 
    $b_txt hexdec(substr($hex_color,4,2));
    $_GET['size'] = $_GET['size']?$_GET['size']:30;
    $_GET['text'] = $_GET['text']?$_GET['text']:"You have not specified any text!!";
    $size imagettfbbox($_GET['size'],0,"$font_file",$_GET['text']);
    $xsize abs($size[0]) + abs($size[2]);
    $ysize abs($size[5]) + abs($size[1]);
    $image imagecreate($xsize,$ysize);
    $bg imagecolorallocate($image,$r_txt,$g_txt,$b_txt);
    $color ImageColorAllocate($image,$r_txt,$g_txt,$b_txt);
    imagettftext($image,$_GET['size'],0,abs($size[0]),abs($size[5]),$color,"$font_file",$_GET['text']);
    imagecolortransparent($image,$bg);
    imagegif($image);
    imagedestroy($image);
    ?>
    Last edited by ori; 25.04.09, 15:34.

    #2
    nice share bro.

    WapCHAT Forum Currenltly changing over to xhtml

    My Dowloads Site

    Comment


      #3
      there few scripts like this but they all got so much code this 1 nice an easy makes integration a piece of cake

      Comment


        #4
        by the way i used a ttf font file to do it so if the font is say arial.ttf jus put arial as the name dnt put .ttf

        Comment


          #5
          heres a demo link for any1 wanting to see it in action

          http://afta-dark.mobi/img.php?color=...20test%20image

          Comment

          Working...
          X