Register

If this is your first visit, please click the Sign Up now button to begin the process of creating your account so you can begin posting on our forums! The Sign Up process will only take up about a minute of two of your time.

Page 1 of 2 1 2 LastLast
Results 1 to 10 of 15

Thread: GD help

  1. #1
    JR
    JR is offline
    Senior Member JR's Avatar
    Join Date
    Nov 2002
    Location
    UK
    Posts
    4,354
    Member #
    257
    I have completely no idea what I am doing here...

    What do I do to write text onto an image? I read that I need something called 'freetype', how do I know if this is currently installed?

    Also, I have a .ttf to use, so you don't have to explain that, I just need some help with the script (I copied and pasted the php.net one and it didn't work).
    JR

  2.  

  3. #2
    Senior Member filburt1's Avatar
    Join Date
    Jul 2002
    Location
    Maryland, US
    Posts
    11,774
    Member #
    3
    Liked
    21 times
    filburt1, Web Design Forums.net founder
    Site of the Month contest: submit your site or vote for the winner!

  4. #3
    JR
    JR is offline
    Senior Member JR's Avatar
    Join Date
    Nov 2002
    Location
    UK
    Posts
    4,354
    Member #
    257
    That is what I tried, I copied and pasted this...
    PHP Code:
    Example 1. imagettftext() example

    <?php
      header
    ("Content-type: image/jpeg");
      
    $im imagecreate(400,30);
      
    $white imagecolorallocate($im255,255,255);
      
    $black imagecolorallocate($im0,0,0);
      
      
    // Replace path by your own font path
      
    imagettftext($im2001020$black"/path/arial.ttf",
      
    "Testing... Omega: &amp;#937;");
      
    imagejpeg($im);
      
    imagedestroy($im);
    ?>
    and I got this...

    <br />
    <b>Fatal error</b>: Call to undefined function: imagettftext() in <b>/httpdocs/tests/gdtest.php</b> on line <b>8</b><br />
    JR

  5. #4
    Senior Member filburt1's Avatar
    Join Date
    Jul 2002
    Location
    Maryland, US
    Posts
    11,774
    Member #
    3
    Liked
    21 times
    Your server doesn't have the library enabled. If you're using Windows, edit php.ini; if you're not, you need to recompile PHP with GD2 support.
    filburt1, Web Design Forums.net founder
    Site of the Month contest: submit your site or vote for the winner!

  6. #5
    JR
    JR is offline
    Senior Member JR's Avatar
    Join Date
    Nov 2002
    Location
    UK
    Posts
    4,354
    Member #
    257
    It is. This is what I got from phpinfo()...

    gd
    GD Support enabled
    GD Version 1.6.2 or higher
    GIF Read Support enabled
    JPG Support enabled
    PNG Support enabled
    WBMP Support enabled
    JR

  7. #6
    Senior Member nsr81's Avatar
    Join Date
    Oct 2002
    Posts
    1,132
    Member #
    250
    Liked
    15 times
    For True Type Fonts, PHP must also have FreeType support compiled into it.
    There and Back Again :Ogre:

  8. #7
    JR
    JR is offline
    Senior Member JR's Avatar
    Join Date
    Nov 2002
    Location
    UK
    Posts
    4,354
    Member #
    257
    I know. Where/will it say that in phpinfo? Or how else will I know?

    You mention "for true type fonts, PHP must also have FreeType support compiled to it" - does that mean that I can use a different font type? I am not sure if I can install freetype on my host if I don't have it.
    JR

  9. #8
    Senior Member nsr81's Avatar
    Join Date
    Oct 2002
    Posts
    1,132
    Member #
    250
    Liked
    15 times
    In the configure command area, it should have "--with-freetype-dir=[DIR]" directive.

    Take a look at my config at http://www.ny-tech.net/phpinfo.php

    Yes, if you have free type, you can load up any TTF font and use it. If you don't have freetype, you can still use one of php's five built-in bitmap fonts.

    Try this page: http://nyphp.org/content/presentations/GDintro/gd23.php
    There and Back Again :Ogre:

  10. #9
    JR
    JR is offline
    Senior Member JR's Avatar
    Join Date
    Nov 2002
    Location
    UK
    Posts
    4,354
    Member #
    257
    Ok, I need to do gd_info right?

    I tried this
    PHP Code:
    <?php
    var_dump
    (gd_info());
    ?>
    But it doesn't work:

    Fatal error: Call to undefined function: gd_info() in /httpdocs/tests/gdtest.php on line 9
    JR

  11. #10
    JR
    JR is offline
    Senior Member JR's Avatar
    Join Date
    Nov 2002
    Location
    UK
    Posts
    4,354
    Member #
    257
    Thanks. I don't have it installed. I will try and persuade my host to install it.
    JR


Page 1 of 2 1 2 LastLast

Remove Ads

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
All times are GMT -6. The time now is 11:43 PM.
Powered by vBulletin® Version 4.2.3
Copyright © 2019 vBulletin Solutions, Inc. All rights reserved.
vBulletin Skin By: PurevB.com