you can change the file the php script looks for by editing this line
change it toCode:$font = 'font.ttf'; //font file
Code:$font = 'font.TTF'; //font file
you can change the file the php script looks for by editing this line
change it toCode:$font = 'font.ttf'; //font file
Code:$font = 'font.TTF'; //font file
Yeah I did that too before but.. still Broken image link :S
Thanks for this, exactly want i needed and VERY helpful![]()
thanks!!!
just the thing i was looking for
prozit.net/ilu/index.php?form=sidewinder
prozit.net/merry/index.php?form=Dan
but i have one little problem
how can i place the text in the midlle
or by pixels
and how can i pu the text in an angle
Last edited by major; 01-13-2007 at 04:04 AM.
Well by following the tutorial you know that these lines account for the location of the text:
Code:$size = imagettfbbox($fontsize, 0, $font, $text);
$dx = (imagesx($im)) - (abs($size[2]-$size[0])) - 20;
is the width of the image andCode:imagesx($im)
is the width of the fontCode:abs($size[2]-$size[0])
In theory taking half the width of the image, and then subtracting half the width of the string should give you centered text so try this
Code:$dx = (imagesx($im)/2) - (abs($size[2]-$size[0])/2);
By taking a look at the php manuals reference to the imagettftext [ PHP: imagettftext - Manual ]Originally Posted by Sidewinder
There for to make the text on an angleangle:
The angle in degrees, with 0 degrees being left-to-right reading text. Higher values represent a counter-clockwise rotation. For example, a value of 90 would result in bottom-to-top reading text.
You would do
Where 45 is the angel degree.Code:imagettftext($im, $size, 45, 15, 12, $color, $font, $text);
This code has not been tested
hth
it is writing
<br />
<b>Fatal error</b>: Call to undefined function: imagettfbbox() in <b>/home/labdan/domains/prozit.net/public_html/gd/in.php</b> on line <b>22</b><br />
http://prozit.net/gd/in.php?text=sadsa
...
how can i solve it
and onther thing
it is the same code for gif and jpg expet from changing image/gif
and
image.gif
?
I never really understood GD, even though I'm pretty advanced at PHP. This cleared a lot of things up, thanks.
Which part of the changed code is causing the error? And no, this code is only meant for png images, there are other functions you can use for gif's and jpg's such as imagecreatefromgif() or imagecreatefromjpeg() rather than imagecreatefromgif(). Although you have to change the functions the general code should remain the same.
For more information on the GD functions take a look here PHP: gd_info - Manual
cool thanks
hello! nice tutorial!! i was just wondering if you know how to wrap the text into a nice paragraph if the string is too long to fit onto the image?
thankyou
kev.
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks
Algorithms and Data Structures
Java tutorials
Algorithms Forum