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.
Images resized using different filters, there are some new filters now.
From the ImageMagick website "If you do not select a filter with this option, the filter defaults to Mitchell for a colormapped image, a image with a matte channel, or if the image is enlarged. Otherwise the filter default to Lanczos." "Since options are evaluated in command line order, be sure to specify the -filter option before the -resize option."
There are more options you can use with the filters ImageMagick filter
Some code to try out all your installed filters on one image:
// Build the array of filters to be used
exec("convert -list filter", $IMarray, $code);
// Start the loop to resize with the different filters
foreach ($IMarray as $value) {
$new_name = $value."_resize.png";
exec ("convert fungi.png -filter $value -resize 300x300 -bordercolor black -border 1x1 $new_name");
echo "<tr><td><img src=\"".$new_name."\"width=\"302\" height=\"268\"></td>";
echo "<td>$value</td></tr>";
}
These images have been resized and the cental cropped portion is displayed below