How to resize image on client-side before upload?

I’ve been using Plupload to resize images on the client side before uploading them to the server. I’ve implemented a front-end form which lets the user select a file from their computer and submit it. My Plupload config looks like this:

var uploader = new plupload.Uploader({
  browse_button: 'browse',
  url: $url,
  resize: {
    width: 100,
    height: 100
  }
});

I’m now using the Simple Local Avatars plugin to let users upload an avatar. Basically, an avatar upload field gets added to user profiles. wp_handle_upload() is used to handle the upload. Is there any way I can resize the image before it’s uploaded to the server (similar to how Plupload does)?

Ref: http://www.plupload.com/docs/Image-Resizing-on-Client-Side

0

Leave a Comment