Rubblewebs

THESE CODES ARE PROVIDED FOR AN EXAMPLE OF HOW TO USE IMAGEMAGICK WITH PHP. CARE SHOULD BE TAKEN WHEN ACCEPTING USER INPUT.

I TAKE NO RESPONSABILTY FOR ANY PROBLEMS THAT MAY OCCURE WHEN USING ANY OF THIS CODE.

IT IS UP TO YOU TO SECURE THE CODE AND VALIDATE USER INPUT.

Wordwrap tests

Annotate

Automatic word wrapping

Automatic word wrapping annotate example
	$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
	$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
	
	exec("convert -size 236x130 xc:lightblue -fill black -font verdana.ttf \\\-pointsize 25 -gravity NorthWest \\\-annotate +0+0 \"The quick red foxjumped over thelazy 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
	 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
	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
	 exec("convert -size 230x130 -background lightblue -font verdana.ttf -pointsize 25 \\\-gravity NorthWest caption:\"The quick red foxjumped over thelazy brown dog.\" \\\-flatten caption4.jpg");
	


Select font to fit image size

Select font to fit image size caption example
	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
	 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
	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
	 exec("convert -size 230x130 xc:lightblue -font verdana.ttf -pointsize 25 -draw \"gravity NorthWest fill black text 0,0 \'The quick red foxjumped overthe lazy brown dog.\'\" draw3.jpg");
	


Caption with a text file.

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