2

I was wondering if there is any way to resize an image on the client side before it is uploaded to the server. I'm using nested attributes for the image portion of the form. Ideally, it wouldn't be uploaded immediately - just resized and it would only then be upload upon submission of the form.

Does anyone know of any plugins that will do this?

EDIT: If there are plugins that will work with IE that would be great too.

jay
  • 305
  • 1
  • 3
  • 12

1 Answers1

2

See these:

Image resizing client-side with javascript before upload to the server

http://www.rubydesigner.com/blog/resizing-images-before-upload-using-html5-canvas

Here's the code for the last one:

https://github.com/josefrichter/resize/blob/master/public/preprocess.js

https://github.com/josefrichter/resize

Community
  • 1
  • 1
Josh Rieken
  • 2,256
  • 1
  • 19
  • 23
  • 1
    Generally, links to a tool or library [should be accompanied by usage notes, a specific explanation of how the linked resource is applicable to the problem, or some sample code](https://meta.stackoverflow.com/a/251605/584192), or if possible all of the above. – Samuel Liew Oct 10 '18 at 05:50