Results 1 to 7 of 7
  1. #1
    Join Date
    Jan 2006
    Location
    Cambridge
    Posts
    1,911
    Tokens
    0

    Latest Awards:

    Default Making An Text Generator

    How would i go about making a text generator where an image is linked to a letter so if u type 'A' an A image would come up
    EDTALKING


  2. #2
    Join Date
    Apr 2005
    Location
    North Carolina, USA
    Posts
    4,535
    Tokens
    0

    Latest Awards:

    Default

    PHP Code:
    <?php
    // create a 100*30 image
    $im = imagecreate(100, 30);
     
    // white background and blue text
    $bg = imagecolorallocate($im, 255, 255, 255);
    $textcolor = imagecolorallocate($im, 0, 0, 255);
     
    // write the string at the top left
    imagestring($im, 5, 0, 0, "Hello world!", $textcolor);
     
    // output the image
    header("Content-type: image/png");
    imagepng($im);
    ?>

  3. #3
    Join Date
    Jan 2006
    Location
    Cambridge
    Posts
    1,911
    Tokens
    0

    Latest Awards:

    Default

    OMG I LOVE YOU

    for that but

    1 how would i change the font and background transparency

    and 2 would this work

    PHP Code:
    <?php
    // create a 100*30 image
    $im = imagecreate(100, 30);
     
    // white background and blue text
    $bg = imagecolorallocate($im, 255, 255, 255);
    $textcolor = imagecolorallocate($im, 0, 0, 255);
     
    // write the string at the top left
    imagestring($im, 5, 0, 0, "<?php include("wotever.php"); ?>", $textcolor);
     
    // output the image
    header("Content-type: image/png");
    imagepng($im);
    ?>
    EDTALKING


  4. #4
    Join Date
    Apr 2005
    Location
    North Carolina, USA
    Posts
    4,535
    Tokens
    0

    Latest Awards:

    Default

    Text.php:
    PHP Code:
    <?php
    // create a 100*30 image
    $im = imagecreate(100, 30);
     
    // white background and blue text
    $bg = imagecolorallocate($im, 255, 255, 255);
    $textcolor = imagecolorallocate($im, 0, 0, 255);

    $string = file_get_contents("wotever.php");
    // write the string at the top left
    imagestring($im, 5, 0, 0, $string, $textcolor);
     
    // output the image
    header("Content-type: image/png");
    imagepng($im);
    ?>
    wotever.php
    PHP Code:
    Testing 123 
    or you can have wotever.html

  5. #5
    Join Date
    Jan 2006
    Location
    Cambridge
    Posts
    1,911
    Tokens
    0

    Latest Awards:

    Default

    PHP Code:
    <?php 
    // create a 100*30 image 
    $im = imagecreate(100, 30); 
     
    // white background and blue text 
    $bg = imagecolorallocate($im, 255, 255, 255); 
    $textcolor = imagecolorallocate($im, 0, 0, 255); 
    $font = '__bmreciept.ttf'  << WOULD THAT WORK LOLZ
     
    $string 
    = file_get_contents("wotever.php"); 
    // write the string at the top left 
    imagestring($im, 5, 0, 0, $string, $textcolor); 
     
    // output the image 
    header("Content-type: image/png"); 
    imagepng($im); 
    ?>
    EDTALKING


  6. #6
    Join Date
    Apr 2005
    Location
    North Carolina, USA
    Posts
    4,535
    Tokens
    0

    Latest Awards:

    Default

    Then you would have to use imagettftext instead of imagestring, it has way more varialbes depending on the font your using

  7. #7
    Join Date
    Jan 2006
    Location
    Cambridge
    Posts
    1,911
    Tokens
    0

    Latest Awards:

    Default

    confuzzled :S

    so like:
    PHP Code:
    <?php 
    // create a 100*30 image 
    $im = imagecreate(100, 30); 
     
    // white background and blue text 
    $bg = imagecolorallocate($im, 255, 255, 255); 
    $textcolor = imagecolorallocate($im, 0, 0, 255); 
    $font = imagettftext(__bmreciept.ttf);
     
    $string = file_get_contents("wotever.php"); 
    // write the string at the top left 
    imagestring($im, 5, 0, 0, $string, $textcolor); 
     
    // output the image 
    header("Content-type: image/png"); 
    imagepng($im); 
    ?>
    Last edited by :Edzy; 17-02-2007 at 07:51 PM.
    EDTALKING


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •