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.
// Draw the red outline to show the distortion
exec("convert $input17 -draw \"fill none stroke red polygon 0,0 0,239, 319,189, 319,50\" after.jpg");
// Carry out the distortion ( you can not split the co-ordinates onto seperate lines )
$cmd = " $input17 -matte -background transparent -virtual-pixel background ".
" -distort Perspective \"0,0 0,0 319,0 319,50 319,239 319,189 0,239 0,239\" ";
exec("convert $cmd car.png");
// Delete the two tempory images
unlink("before.jpg");
//unlink("after.jpg");