Results 1 to 2 of 2
  1. #1
    Join Date
    Apr 2006
    Location
    Leamington Spa
    Posts
    1,375
    Tokens
    72

    Latest Awards:

    Default Help with GD anyone?

    Right, I've been trying with GDLib for about 1/2 hour now without any luck...
    So maybe one of you can assist me
    Here's my gdtest.php code:

    PHP Code:
    <?php

    header
    ("Content-type: image/png");
    $string ="If you can see this then I assume it's working?";
    $im imagecreatefrompng("button1.png");
    $orange imagecolorallocate($im22021060);
    $px = (imagesx($im) - 7.5 strlen($string)) / 2;
    imagestring($im3$px9$string$orange);
    imagepng($im);
    imagedestroy($im);

    ?>
    It outputs "
    The image “http://localhost/site/gdtest.php” cannot be displayed, because it contains errors."

    "gd" part of my phpinfo page:



    Any help would be greatly appreicated, and I'd rep you obv.
    Last edited by lolwut; 19-10-2007 at 12:08 PM.
    i've been here for over 8 years and i don't know why

  2. #2
    Join Date
    Oct 2006
    Posts
    2,918
    Tokens
    946
    Habbo
    Verrou

    Latest Awards:

    Default

    File Name: index.html
    HTML Code:
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
    <title>GD Text Maker!</title>
    </head>
    
    <body>
    <form action="gd.php" method="post"><br />
    Text: <input type="text" name="text" />
    <br />
    Colour:
    <input type="text" name="rgb" value="0,0,0" />
    <br />
    Size:
    <input type="text" name="size" value="1-10" />
    <br />
    Font:
    <select name="font">
    <option value="arial.ttf">Arial</option>
    <option value="volter.ttf">Volter</option>
    <option value="volter-bold.ttf">Volter-Bold</option>
    </select>
    <br />
    <input type="submit" value="Submit!" name="submit" />
    </form>
    </body>
    </html>
    File Name: gd.php
    PHP Code:
    <?php

    header
    ("Content-type: image/png");



    $font $_POST['font'];

    $get_colour $_POST['rgb'];

    $string $_POST['text'];

    $colours explode(","$get_colour);

    $font_size $_POST['size'];

    $im imagecreatetruecolor(700,45)

            or die(
    "Cannot initialize GD image stream.");

    $bg imagecolorallocate($im255,255,255);

    $colour imagecolorallocate($im$colours[0], $colours[1], $colours[2]);

    imagefill($im0,0$bg); 

    imagettftext($im,$font_size039$color$font$string);

    imagepng($im);

    imagedestroy($im);

    ?>
    Background Image:

    (Save as textImage.png)

    And add whatever font's you want.
    Last edited by Verrou; 19-10-2007 at 12:11 PM.
    Quote Originally Posted by Special-1k View Post
    How do you uninstall an internet? I want to uninstall my Google Chrome and
    get firefox but I never really got rid of an internet my dad usually did it for me.
    If you know how post below so I can do this.

Posting Permissions

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