How to resize images before upload

Asked

Viewed 262 times

0

Good afternoon guys, my application already uploads images using <input type="file">, but only images that are less than 2mb. I am storing the target.result in the bank and returning in a <img>. A file over 2mb from a serialization error or exceeds the request limit. I wonder if you have any way to reduce the image before making the ajax request, in javascript. I’m researching and if I find I put here.

  • I made such a system that removed even the EXIF of the image, in select selected the image and passed it to a CANVAS with size determined dynamically by JAVASCRIPT. Soon on Canvas just take the contents in BASE64 and put the String in the contents of a file. The name of the image can also be acquired by Javascript. I’ll recreate that system and put it here, but I’ll confirm everything I said before. (I didn’t use Jquery because I was terrified of messing with Apis at the time)

  • I was studying the use of Apis, but due to the caution of some superiors regarding the integrity of the images I could not continue the study. I’ll take a look at this method of CANVAS.

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.