GD-lib

Need help with Photoshop, the GIMP, Illustrator, or others? Want to show off your work? Looking for advice on your newest Flash stuff?

Moderator: General Moderators

Post Reply
Yonderknight
Forum Commoner
Posts: 31
Joined: Sun Jun 13, 2004 6:51 pm

GD-lib

Post by Yonderknight »

Hi,
I just found out about gd-lib. Where can you get it and how do I install it??

Thanks!
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

did you try looking on php.net? http://www.php.net/gd
Yonderknight
Forum Commoner
Posts: 31
Joined: Sun Jun 13, 2004 6:51 pm

Post 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
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post 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..
Yonderknight
Forum Commoner
Posts: 31
Joined: Sun Jun 13, 2004 6:51 pm

Post 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.
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

remove the ; in front of it.. and try restarting apache..
Yonderknight
Forum Commoner
Posts: 31
Joined: Sun Jun 13, 2004 6:51 pm

Post 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!
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post 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..
Yonderknight
Forum Commoner
Posts: 31
Joined: Sun Jun 13, 2004 6:51 pm

Post 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!
Yonderknight
Forum Commoner
Posts: 31
Joined: Sun Jun 13, 2004 6:51 pm

Post 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
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

you have a newer version of GD, so you'll want to use imagecreatetruecolor() instead of imagecreate
Yonderknight
Forum Commoner
Posts: 31
Joined: Sun Jun 13, 2004 6:51 pm

Post by Yonderknight »

When I try either one, even when they're just by themselves, it produces a garbled text.
hmmmm..
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post 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..
Yonderknight
Forum Commoner
Posts: 31
Joined: Sun Jun 13, 2004 6:51 pm

Post 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... :D
Post Reply