Page 1 of 1
GD-lib
Posted: Wed Jul 21, 2004 3:18 pm
by Yonderknight
Hi,
I just found out about gd-lib. Where can you get it and how do I install it??
Thanks!
Posted: Wed Jul 21, 2004 3:19 pm
by feyd
did you try looking on php.net?
http://www.php.net/gd
Posted: Wed Jul 21, 2004 3:22 pm
by Yonderknight
I got to the GD website, but I'm not very good at this.
I already have PHP installed, so what should I download?
Thanks
Posted: Wed Jul 21, 2004 3:24 pm
by feyd
you may already have it installed, just need to turn it on.. look through your php.ini and you install's extensions folder.. enable it in php.ini and make sure it's in the extensions folder.. restart apache..
Posted: Wed Jul 21, 2004 3:29 pm
by Yonderknight
hmm. When i look through the PHP.ini for GD, I only find ";extension=php_gd2.dll"
I had PHP installed by an executable that bundled Apache, PHP, MySQL, and PHPmyAdmin, and it has no information if it installed Gd-lib with it.
Posted: Wed Jul 21, 2004 3:32 pm
by feyd
remove the ; in front of it.. and try restarting apache..
Posted: Wed Jul 21, 2004 3:37 pm
by Yonderknight
Thanks. I'm pretty sure it works now, since it doesn't say "undefined function"
But i'm using some sample script that I got from a person's website just to learn off of.
Code: Select all
<?PHP
$image = imagecreatefrompng("FLASH.png");
$font_size = 14;
$color = imagecolorallocate($image, 255,255,255);
$black = imagecolorallocate($image, 0,0,0);
ImageTTFText ($image, $font_size, 0, 56, 36, $black, "../fonts/ARIALBD.TTF","Test Text");
ImageTTFText ($image, $font_size, 0, 55, 35, $color, "../fonts/ARIALBD.TTF","Test Text");
header("Content-type: image/png");
imagepng($image);
imagedestroy($image);
?>
It produces garbled up text. Is it something wrong with the script or the server??
EDIT:
I think its because i need the Fonts in my www root folder.
Thanks Alot!
Posted: Wed Jul 21, 2004 3:45 pm
by feyd
first things first, FLASH.png exists? "../fonts/ARIALBD.TTF" exists?
try moving ARIALBD.TTF to the scripts directory, lose the FLASH.png reference, and use [php_man]imagecreatetruecolor[/php_man]() to create a temporary one..
Posted: Wed Jul 21, 2004 3:47 pm
by Yonderknight
Yeah, it was because i needed the font in my root folder.
Thanks a lot! You saved me a lot of time trying to figure out these install guides!
Thanks!
Posted: Wed Jul 21, 2004 4:19 pm
by Yonderknight
Whenever I use ImageCreate() it produces garbled text. I got an example from the PHP site and it didn't work. If its an old version of GD, if i need to update it, do I only have to change the Gd2.dll?
Thanks
Posted: Wed Jul 21, 2004 4:52 pm
by feyd
you have a newer version of GD, so you'll want to use imagecreatetruecolor() instead of imagecreate
Posted: Wed Jul 21, 2004 8:30 pm
by Yonderknight
When I try either one, even when they're just by themselves, it produces a garbled text.
hmmmm..
Posted: Wed Jul 21, 2004 8:48 pm
by feyd
I don't think by default the created image is cleared or filled with any color, you have to fill it.. otherwise, yes, it will have random data from memory (probably) stored.. unless it's a fully secure OS..
Posted: Wed Jul 21, 2004 10:50 pm
by Yonderknight
Oh. I got it
It was a dumb mistake. I had some HTML after the code so it screwed things up.
Thanks for all the time you spend helping people like me! I wish I could repay you....
If you ever need any graphic work...
