Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
imagettftext word wrapping an image string
<? php
function imagettfmultilinetext($image, $size, $angle, $x, $y, $color, $fontfile, $text, $spacing=1) {
for($i=0; $i< count($lines); $i++) {
$newY=$y+($i * $size * $spacing);
imagettftext($image, $size, $angle, $x, $newY, $color, $fontfile, $lines[$i], $spacing);
return null;
$text = $_GET['description'];
$new_text = wordwrap($text, 20, '\n');
imagettfmultilinetext($im, 18, 0, 10, 90, $white, $font, $new_text);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.