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.

Vertical text

Vertical text example
 
exec("convert -size 20x20 xc:white -fill black -pointsize 20 -gravity center -draw \" text 0,0 \"R\" \" R.gif");
exec("convert -size 20x20 xc:white -fill black -pointsize 20 -gravity center -draw \" text 0,0 \"u\" \" u.gif");
exec("convert -size 20x20 xc:white -fill black -pointsize 20 -gravity center -draw \" text 0,0 \"b\" \" b.gif");
exec("convert -size 20x20 xc:white -fill black -pointsize 20 -gravity center -draw \" text 0,0 \"l\" \" l.gif");
exec("convert -size 20x20 xc:white -fill black -pointsize 20 -gravity center -draw \" text 0,0 \"e\" \" e.gif");
exec("convert -size 20x20 xc:white -fill black -pointsize 20 -gravity center -draw \" text 0,0 \"w\" \" w.gif");
exec("convert -size 20x20 xc:white -fill black -pointsize 20 -gravity center -draw \" text 0,0 \"s\" \" s.gif");
exec("convert -background none -gravity Center R.gif u.gif b.gif b.gif l.gif e.gif w.gif e.gif b.gif s.gif -append text_vertical.gif");

// Delete the tempory images 
$delete = array('R.gif','u.gif','b.gif','l.gif','e.gif','w.gif','s.gif'); 
foreach ($delete as $value) { 
    unlink($value); }

//Another method :

//This works by adding the line feeds \n between the letters.

exec("convert -pointsize 20 -gravity center label:T\\nE\\nX\\nT vertical_text.gif");

//With this code you can automaticaly add the \n to every character in the string.
//The last character will not have a \n

 $string="TEXT";
 for ($pos = 0; $pos < strlen($string); $pos++)
 if ( $pos != strlen($string)-1 ){
	$modified .= substr($string, $pos, 1)."\\n"; }
		
	else $modified .= substr($string, $pos, 1);
		
exec("convert -pointsize 20 -gravity center label:$modified label_vertical1.gif");


Back