GD Library..

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
teckyan888
Forum Commoner
Posts: 40
Joined: Tue May 11, 2004 10:46 am

GD Library..

Post by teckyan888 »

Anyone who familiar with GD Library???
I set the Gd Library inside the php.in follow the instruction, but cannot display anything by using the example...
Anyone who know how to set it in my php??can show me step by step???
Thanks if anyone can help me...
kettle_drum
DevNet Resident
Posts: 1150
Joined: Sun Jul 20, 2003 9:25 pm
Location: West Yorkshire, England

Post by kettle_drum »

Firsty of all what OS are you using? What version of php? have you compiled it yourself?
teckyan888
Forum Commoner
Posts: 40
Joined: Tue May 11, 2004 10:46 am

Post by teckyan888 »

Actually i already follow these step:
Go to the “php.ini” and under the “Dynamic Extensions “ you will see “extension_dir = c:/php/includes” and “extension=php_gd.dll” Uncomment the line (i.e. remove the ; before the line)and ensure that you have the “php_gd2.dll” in the specific directory.

Then,i go to the command or shell prompt Execute “php –m” and that “GD” module is found.

After that, i try example:

Code: Select all

<?php

$im = imagecreate (250, 28); 
$black = ImageColorAllocate ($im, 0, 0, 0); 
$yellow = ImageColorAllocate ($im, 235, 235, 51); 
ImageTTFText ($im, 20, 0, 10, 20, $yellow, "/WINDOWS/Fonts/IMPACT.ttf", 
"IMPACT FONT HIP HIP Hurray!!!"); 
ImagePNG($im); 
?>

Then,it display this message:


[php_man]Fatal error: Call to undefined function: imagecreate() in C:\Program Files\Apache Group\Apache2\htdocs\cb359\test1.php on line 2
[/php_man]

So,can u help me see to see whether i forget to set up anything???

I used php 4.3.5 in windows XP....

Code: Select all

?>
User avatar
phpScott
DevNet Resident
Posts: 1206
Joined: Wed Oct 09, 2002 6:51 pm
Location: Keele, U.K.

Post by phpScott »

have you restarted your web server?

make sure that the gd2.dll is in the correct directory.

make a simple phpinfo page.

Code: Select all

<?php
echo phpinfo();
?>
and see if you get the gd library listed on the page.
It is also a good place to see where the extensions directory is pointing too.
Post Reply