An example of mogrify
NOTE: MOGRIFY OVERWITES THE ORIGINAL FILENAME - REMEMBER THIS !
Read all the jpg images in a folder resize them to 100px wide and save them with the original filename - put this file into the folder that needs the images and run it.
exec("/usr/local/bin/mogrify -size 100x *.jpg");
But saying this it will not work on my server as the file permisions are wrong. I need to use an FTP program to change the file permisions to 777 then run the code.
This would just resize the one image specified
exec("/usr/local/bin/mogrify -size 100x earth.jpg");