如何在宽图像文本中应用换行


how to apply word wrap in wideimage texts?

如何使用php wideimage编写长文本到小图像?

这是我使用的php代码,

$bg = WideImage::load("fbpostbg.png");
$final= $bg ->resize(400, 400);
$canvas = $final ->getCanvas();
$canvas->useFont('verdana.ttf', 14, $final->allocateColor(000, 000, 000));
$canvas->writeText('left +10', 'top +10', 'This is the text that I need to write to the above image, which is quite long...');
$final->output('jpg', 90);  

此输出带有图像画布之外的一些文本,并且无法看到…
我需要在我们写到图像的文本中进行换行,并且需要获得包含全文的图像。

我刚开始使用WideImage,请帮帮我。

使用php的换行函数参见:http://php.net/manual/en/function.wordwrap.php

 $wrappedtext = wordwrap('This is the text that I need to write to the above image, which is quite long...', 60, "'n");
 $canvas->writeText('left +10', 'top +10',$wrappedtext);