There is plenty of information on the web about resizing an uploaded image on the server. I can't find any information about resizing it on the client instead.
I am using this PHP code to handle the upload. It works, but my web server only accepts uploads of 2 MB or smaller. Therefore, I want the client side code to resize the uploaded image to be no larger than this.