note 92112 added to function.imagickdraw-annotation
| From: | use_contact_form at Jonas-Kress dot de | Date: | Thu, 09 Jul 2009 10:33:06 +0000 |
| Subject: | note 92112 added to function.imagickdraw-annotation | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-158097@lists.php.net to get a copy of this message | ||
may help someone...
/**
* Split the given text into rows fitting the given maxWidth
*
* @param unknown_type $draw
* @param unknown_type $text
* @param unknown_type $maxWidth
* @return array
*/
private function getTextRows($draw, $text, $maxWidth)
{
$words = explode(" ", $text);
$lines = array();
$i=0;
while ($i < count($words))
{//as long as there are words
$line = "";
do
{//append words to line until the fit in size
if($line != ""){
$line .= " ";
}
$line .= $words[$i];
$i++;
if(($i) == count($words)){
break;//last word -> break
}
//messure size of line + next word
$linePreview = $line." ".$words[$i];
$metrics = $this->canvas->queryFontMetrics($draw, $linePreview);
//echo
$line."($i)".$metrics["textWidth"].":".$maxWidth."<br>";
}while($metrics["textWidth"] <= $maxWidth);
//echo "<hr>".$line."<br>";
$lines[] = $line;
}
//var_export($lines);
return $lines;
}
----
Server IP: 217.13.201.10
Probable Submitter: 213.83.23.168
----
Manual Page -- http://www.php.net/manual/en/function.imagickdraw-annotation.php
Edit -- https://master.php.net/note/edit/92112
Del: integrated -- https://master.php.net/note/delete/92112/integrated
Del: useless -- https://master.php.net/note/delete/92112/useless
Del: bad code -- https://master.php.net/note/delete/92112/bad+code
Del: spam -- https://master.php.net/note/delete/92112/spam
Del: non-english -- https://master.php.net/note/delete/92112/non-english
Del: in docs -- https://master.php.net/note/delete/92112/in+docs
Del: other reasons-- https://master.php.net/note/delete/92112
Reject -- https://master.php.net/note/reject/92112
Search -- https://master.php.net/manage/user-notes.php