title: Resize image on client side before uploading to the server
body: <p>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.</p>
  
  <p>I am using <a href="https://stackoverflow.com/a/30557954/4842333">this</a> 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.</p>