Page 1 of 1

GD Add Black Bar + Text to bottom of Image

Posted: Fri Oct 06, 2006 2:49 pm
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!

Posted: Fri Oct 06, 2006 2:50 pm
by Burrito
moved to GD

Posted: Fri Oct 06, 2006 2:52 pm
by Burrito
have a look at these two functions you should:

imagefilledrectangle() and imagettftext()

Posted: Fri Oct 06, 2006 3:20 pm
by onion2k
http://www.phpgd.com/scripts.php?script=38

That script does what you want.

Posted: Fri Oct 06, 2006 4:23 pm
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?

Posted: Wed Dec 13, 2006 6:28 am
by Mini
did you upload the font?