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.
With most of my examples I save the output to a file; there may be a time when you do not want to do this but just display the image. You need a slightly different code to do this with php
The code is saved on a page in this case called image.php; then you use the standard image call tags to call the page <img src="image.php">
$photo="sunflower.jpg";
$cmd = "convert $photo -thumbnail 200x200 ".
" -unsharp 0.2x0.6+1.0 -quality 100 JPG:-";
header("Content-type: image/jpeg");
passthru($cmd, $retval);
system("convert ../code/sunflower.jpg -resize 200x200 JPG:-");
$animation = "original.gif";
$watermark = "output.png";
$cmd = "convert $animation -coalesce -gravity Center -geometry +0+0 ".
" null: $watermark -layers composite -layers optimize GIF:-";
header("Content-type: image/gif");
passthru($cmd, $retval);