Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 7 of 7
  1. #1
    Regular Coder Ranger56's Avatar
    Join Date
    Mar 2005
    Location
    Kent, WA.
    Posts
    783
    Thanks
    0
    Thanked 0 Times in 0 Posts

    php image generation?

    Is it possible with php to create an image from a font on the server? something like

    Code:
    <img src="images/name.php?name=Someone">
    And "Someone" would be an image?

  • #2
    Regular Coder
    Join Date
    Oct 2003
    Posts
    603
    Thanks
    2
    Thanked 1 Time in 1 Post
    yes it is possible.

    to create an image from an image with name "someone"....
    file: images/name.php....
    PHP Code:
    <?php
    header
    ("Content-Type: image/jpeg");
    $im imagecreatefromjpeg($_GET['name']);
    imagejpeg($im);
    ?>
    if you meant have the image just output the name that is in ?name=Someone with a custom font, do this in images/name.php
    PHP Code:
    <?php
    header
    ("Content-Type: image/jpeg");
    $im imagecreatetruecolor(10030); //100x30
    $color imagecolorallocate($im000); //black text
    $font imageloadfont("FONT FILE HERE");
    imagestring ($im$font00$_GET['name'], $color); 
    imagejpeg($im);
    ?>
    Last edited by boeing747fp; 08-22-2006 at 04:31 AM.

  • #3
    Regular Coder Ranger56's Avatar
    Join Date
    Mar 2005
    Location
    Kent, WA.
    Posts
    783
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Thanks, I'll try it.

    Edit: I tried
    PHP Code:
    <?php
    header
    ("Content-Type: image/jpeg");
    $im imagecreatetruecolor(10030); //100x30
    $color imagecolorallocate($im000);
    $font imageloadfont("jiczyn.ttf");
    imagestring ($im$font00$_GET['name'], $color); 
    imagejpeg($im);
    ?>
    And all it does it put the url on the page.

    Link: http://www.spiderseatbabies.com/hate/name.php
    Last edited by Ranger56; 08-22-2006 at 04:53 AM.

  • #4
    Regular Coder
    Join Date
    Oct 2003
    Posts
    603
    Thanks
    2
    Thanked 1 Time in 1 Post
    create a separate page not named name.php and put
    Code:
    <img src="name.php?name=ME">
    and try to access to new page

  • #5
    Regular Coder Ranger56's Avatar
    Join Date
    Mar 2005
    Location
    Kent, WA.
    Posts
    783
    Thanks
    0
    Thanked 0 Times in 0 Posts

  • #6
    UE Antagonizer Fumigator's Avatar
    Join Date
    Dec 2005
    Location
    Utah, USA, Northwestern hemisphere, Earth, Solar System, Milky Way Galaxy, Alpha Quadrant
    Posts
    7,691
    Thanks
    42
    Thanked 637 Times in 625 Posts
    Worked for me, but I didn't try loading my own font. Try a default font first.

    My test

  • #7
    Regular Coder Ranger56's Avatar
    Join Date
    Mar 2005
    Location
    Kent, WA.
    Posts
    783
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Still doesn't work for me...


  •  

    Posting Permissions

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