i have a little Problem with ImageMagick. I want to place some Text on an Image. I want to avoid overlap the Text.
The Position is random(x, y) is it possible to avoid the overlap? "Is there some text, dont put it on this position.. .
I want to write some Text on a big Map. Without overlap.
This is my Code (PHP):
Code: Select all
$width = 1024;
$height = 768;
$draw->setFillColor('black');
$draw->setFont('wyswindsorhand.ttf');
$sql = "SELECT spruch, userID FROM sprueche LIMIT 20";
$todo = mysql_query($sql);
while($daten = mysql_fetch_array($todo))
{
$draw->setFontSize(rand(50,80));
$spruch = $daten['spruch'];
$userID = $daten['userID'];
$x = rand(1,$width);
$y = rand(1,$height);
$drehung = mt_rand(-20, 20);
$img->annotateImage($draw, $x, $y, $drehung, utf8_encode($spruch));
}
$img->setImageFormat('jpg');
$img->writeImage("tmp/img/map.jpg");
Thanks for this..
Best regards
kenny