Snippets - Utilities
NOTE: Most of the IM snippets have been tested on IM version 6.3.5 There may be some differences if you are using the code on other versions.
Shell script - Anthony 15/6/2008
Using a shell script with php and IM. Download the script and upload it to your server. Change the permissions to 755 on the script. Write your php code like this using the full path to the script
<?php// Run the scriptexec("/FULL PATH TO SCRIPT/autotrim.sh input.png output.png 2>&1", $array);//Display any errorsecho "<br>".print_r($array)."<br>";echo "</pre>";///* When I ran the code I recived an error:/autotrim.sh: line 271: bc: command not foundbc is a calculator that is built into Unix/Linux.I ran the code below to get some information about the path for bc and it did not return anything so I assumed bc was not installed.I contacted my hosts who installed it and the code worked OK.*/echo "<pre>";system(which bc,$path); print_r($path);echo "</pre>";?>//Alternative method using "back ticks"<?php`/FULL PATH TO SCRIPT/texteffect.sh -t "Anthony" -s glow -e normal -f verdana.ttf -p 48 -c skyblue -b white -o skyblue -l 1 -m 10 -g blue back_tick.png`;?>
For more examples and information check out the main Imagemagick section.
Batch file ViewFonts installed View
Fonts Installed view View
Gravity option View
http image source View
Image information View
New image size in variable View
Path - find automaticly View
Path to Imagemagick View
Setup Information View
Shell script View
Variables in the code View
Version of Imagemagick installed View
Writing IM code View