PHP: Need to convert imagemagick command to php script
问题 I use this command to batch modify images for a site. They need to be this size to suit the theme. Now I also want to use these images in Facebook Ads, but they have to be resized. The command I use (which works fine) is: for i in `ls -1 *.jpg`; do convert $i -fuzz 10% -trim +repage -resize 980x1200 -background white -gravity center -extent 980x1200 $i; done Now I need to make a PHP script that does the same, but also returns the image as response. I came up with the following: <?php /*