GD Add Black Bar + Text to bottom of Image

GD and GD2 are useful libraries for creating graphics on-the-fly. Discuss your PHP GD and GD2 scripts here.

Moderators: onion2k, General Moderators

Post Reply
AlexC
Forum Commoner
Posts: 83
Joined: Mon May 22, 2006 10:03 am

GD Add Black Bar + Text to bottom of Image

Post by AlexC »

Hey,

I am wanting to add a little Copyright/Info bar at the bottom of every picture I upload using the Upload/Resize script I have coded ( using GD ). How would I go about adding say a 20-30px in height black bar to the bottom of every picture then put some text on it in white?

Thansk!
User avatar
Burrito
Spockulator
Posts: 4715
Joined: Wed Feb 04, 2004 8:15 pm
Location: Eden, Utah

Post by Burrito »

moved to GD
User avatar
Burrito
Spockulator
Posts: 4715
Joined: Wed Feb 04, 2004 8:15 pm
Location: Eden, Utah

Post by Burrito »

have a look at these two functions you should:

imagefilledrectangle() and imagettftext()
User avatar
onion2k
Jedi Mod
Posts: 5263
Joined: Tue Dec 21, 2004 5:03 pm
Location: usrlab.com

Post by onion2k »

http://www.phpgd.com/scripts.php?script=38

That script does what you want.
AlexC
Forum Commoner
Posts: 83
Joined: Mon May 22, 2006 10:03 am

Post by AlexC »

Thanks for the links guys, I have managed to get it working with imagestring() but the font is horrible so I am now trying imagettftext() BUT it displays no text, here is the code I am using:

Code: Select all

imagettftext( $newImage, 20, 0, 5, 5, $black, 'verdana.tff', $text );
Could it be because of my position? I want it 5px from the left, and 5px from the bottom and in the font Verdana if that's possible?
User avatar
Mini
Forum Newbie
Posts: 23
Joined: Mon Dec 04, 2006 4:39 am
Location: Netherlands

Post by Mini »

did you upload the font?
Post Reply