http://www.ffwbmarion.com/imagergd/t...it%20is%20test
How can I get this to wrap to a new line?
I cant figure out the imagettfbox
Printable View
http://www.ffwbmarion.com/imagergd/t...it%20is%20test
How can I get this to wrap to a new line?
I cant figure out the imagettfbox
Is this for H-R by any chance? :P
Yes it is ;)
Yay more good features
EDIT: Use wordwrap() ?
Gifts too :)
If only I could figure this out
Would this help
http://www.php.net/wordwrap
No but thanks tho. I already tried that.
Its something to do with imagettfbox
You mean imagettfbbox?
yea that :P
This was on php.net, helpful?
PHP Code:<?php
function imageWordWrapBBox ( $Text, $Width = 650, $FontSize = 10, $Font = './fonts/arial.ttf' )
{
$Words = split ( ' ', $Text );
$Lines = array ( );
$Line = '';
foreach ( $Words as $Word )
{
$Box = imagettfbbox ( $FontSize, 0, $Font, $Line . $Word );
$Size = $Box[4] - $Box[0];
if ( $Size > $Width )
{
$Lines[] = trim ( $Line );
$Line = '';
}
$Line .= $Word . ' ';
}
$Lines[] = trim ( $Line );
$Dimensions = imagettfbbox ( $FontSize, 0, $Font, 'AJLMYabdfghjklpqry019`@$^&*(,' );
$lineHeight = $Dimensions[1] - $Dimensions[5];
return array ( $lineHeight, $Lines, $lineHeight * count ( $Lines ) );
}
function imageWordWrap ( $Text, $Width, $Color, $X = 0, $Y = 0, $FontSize = 10, $Font = './fonts/arial.ttf' )
{
$Data = $this->imageWordWrapBBox ( $Text, $Width, $FontSize, $Font );
foreach ( $Data[1] as $Key => $Line )
{
$locX = $X;
$locY = $Y + ( $Key * $Data[0] );
imagettftext ( $this->Image, $FontSize, 0, $locX, $locY, $Color, $Font, $Line );
}
return $Data;
}
?>