Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

mobile safari image upload & their sizes

Ok so as many of know, safari mobile now allows file uploads through camera or image library.

The 'problem' is that when the picture is taken from the camera, it is sent as it is, meaning it is very heavy in memory (I think it's around 2 or 3 mb even on iphone 4).

This makes the upload really slow and also bandwidth consuming (not good for mobile). Do you know if, with the <file /> html tag, there is a way to say to iOS: "hey, can you also compress the picture a bit?" - like it's being done when said images are sent via the mail app.

Thanks in advance.

like image 516
john smith Avatar asked Apr 08 '13 10:04

john smith


1 Answers

There's a library for that: https://github.com/gokercebeci/canvasResize

It works by putting the image to a <canvas /> (smaller than original image), then getting the image data so you can post it to your server.

like image 86
pawel Avatar answered Sep 18 '22 14:09

pawel