脚本宝典收集整理的这篇文章主要介绍了php – 如何在多行(段落中)中编写文本?,脚本宝典觉得挺不错的,现在分享给大家,也给大家做个参考。
function wrITetext($image_path,$imgdestpath,$x,$y,$angle,$text,$font,$fontsize) { $image=imagecreatefromjPEg("$image_path"); $height = imageSY($image); $width = imageSX($image); $color = imagecolorallocate($image,0); $textwidth = $width; imageTTFtext($image,$fontsize,$color,$text ); ImageJPEG($image,$imgdestpath); }
请告诉我如何在多行段落中制作此图像?
$text = 'Lorem ipsum dolor sit amet,consectetur adipiscing elit. Integer non nunc lectus. Curabitur hendrerit bibendum enim dignissim tempus. Suspendisse non ipsum auctor metus consectetur eleifend. Fusce cursus ullamcorper SEM nec ultricies. Aliquam erat volutpat. Vivamus massa justo,pharetra et soDales quis,rhoncus in ligula. Integer dolor velit,ultrices in iaculis nec,viverra ut nunc.'; // break it up into pieces 125 characters long $lines = explode('|',wordwrap($text,115,'|')); // Starting Y position $y = 513; // Loop through the lines and place them on the image foreach ($lines as $line) { imagettftext($image,$font_size,50,$font_color,$line); // Increment Y so the next line is below the prevIoUs line $y += 23; }
以上是脚本宝典为你收集整理的php – 如何在多行(段落中)中编写文本?全部内容,希望文章能够帮你解决php – 如何在多行(段落中)中编写文本?所遇到的问题。
本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。