Wordwrap tests

Annotate

Automatic word wrapping

Automatic word wrapping annotate example
<?php 
$cmd 
" -size 236x130 xc:lightblue -fill black -font verdana.ttf ".
" -pointsize 25 -gravity NorthWest ".
" -annotate +0+0 \"The quick red fox jumped over the lazy brown dog.\" ";
exec("convert $cmd annotate1.jpg");
?>


Forced word wrapping

Forced word wrapping annotate example
<?php 
$cmd 
" -size 236x130 xc:lightblue -fill black -font verdana.ttf ".
" -pointsize 25 -gravity NorthWest ".
" -annotate +0+0 \"The quick red fox\\njumped over\\nthe lazy brown\\ndog.\" ";
exec("convert $cmd annotate2.jpg");
?>


Normal line feeds - Using a normal end of line on the text inside the " "

Normal line feeds annotate example
<?php 
exec
("convert -size 236x130 xc:lightblue -fill black -font verdana.ttf \\
-pointsize 25 -gravity NorthWest \\
-annotate +0+0 \"The quick red fox
jumped over the
lazy brown dog.\" annotate3.jpg"
);
?>


Caption

Using NorthWest aligns the text left and NorthEast aligns the text right;
as well as locating the text on the background.

Automatic word wrapping

Automatic word wrapping caption example
<?php 
exec
("convert -size 230x130 -background lightblue -font verdana.ttf -pointsize 25 \\
-gravity NorthWest caption:\"The quick red fox jumped over the lazy brown dog.\" \\
-flatten caption1.jpg"
);
?>


Forced word wrapping

Forced word wrapping caption example
<?php 
exec
("convert -size 230x130 -background lightblue -font verdana.ttf -pointsize 25 \\
-gravity NorthWest caption:\"The quick red fox\\njumped over\\nthe lazy brown dog.\" \\
-flatten caption2.jpg"
);
?>


Normal line feeds - Using a normal end of line on the text inside the " "

Normal line feeds caption example
<?php 
exec
("convert -size 230x130 -background lightblue -font verdana.ttf -pointsize 25 \\
-gravity NorthWest caption:\"The quick red fox
jumped over the
lazy brown dog.\" \\
-flatten caption4.jpg"
);
?>


Select font to fit image size

Select font to fit image size caption example
<?php 
exec
("convert -size 230x130 -background lightblue -font verdana.ttf \\
-gravity NorthWest \\
caption:\"The quick red fox jumped over the lazy brown dog.\" -flatten caption3.jpg"
);
?>


Draw

Automatic word wrapping

Automatic word wrapping draw example
<?php 
exec
("convert -size 230x130 xc:lightblue -font verdana.ttf -pointsize 25 \\
-draw \"gravity NorthWest fill black text 0,0 'The quick red fox jumped over the lazy brown dog.'\"\\
draw2.jpg"
);
?>


Forced word wrapping

Forced word wrapping draw example
<?php 
exec
("convert -size 230x130 xc:lightblue -font verdana.ttf -pointsize 25 \\
-draw \"gravity NorthWest fill black text 0,0 'The quick red fox\\njumped over\\nthe lazy brown dog.'\"\\
draw2.jpg"
);
?>


Normal line feeds - Using a normal end of line on the text inside the ' '

Normal line feeds draw example
<?php 
exec
("convert -size 230x130 xc:lightblue -font verdana.ttf -pointsize 25\\
 -draw \"gravity NorthWest fill black text 0,0 'The quick red fox
jumped over
the lazy brown dog.'\" draw3.jpg"
);
?>


Caption with a text file.

Caption with a text file example
<?php 
exec
("convert -background lightblue -fill black -font verdana.ttf -pointsize 25 \\
-size 230x caption:@text.txt caption_file.gif"
);
?>