0

I'm working on a Web application that allows images to be uploaded to the server, but the pictures take quite some some time to upload via 3g/h. I'm wondering is there some kind of way to pre-compress the image on taking or uploading them?

For example, the user takes a picture at 3g/h, depending on the camera about 2 - 3 mb, and starts the upload. It takes a while or the connection breaks at a 3g - g - h or whatever switch or drop. The browser doesn't take that well, and the image can and will be lost.

Any advice please. :)

PS. I'm talking about a cross (mobile) browser / cross (mobile) platform

Expedito
  • 7,771
  • 5
  • 30
  • 43
TheDevRay
  • 52
  • 1
  • 8
  • 1
    you can use a canvas tag to resize an image into a jpeg dataURL of custom jpeg quality, which can then be uploaded. – dandavis May 09 '13 at 16:25
  • Have you looked into canvas? There's still mixed support for this on the desktop, so you've got your work cut out for mobile I'm afraid. – Graham May 09 '13 at 16:27
  • I guess you could always draw the image to a canvas, before resizing/encoding it. Problem is though, that you get back a base64 encoded string, which actually takes slightly more space to store. If the browser gzips the response, it can be comparable, but I don't think it ever gets any better(than the size of the original image) Only (unpalatable?) option I can think of is a native-app that runs on the mobile devices, thus giving you access to libjpeg libpng zlib etc, etc. Shame the network infrastructure is so crappy where you and your visitors live. :( – enhzflep May 09 '13 at 16:30

1 Answers1

0

I think this has been answered. You mention cross browser/cross mobile platform which assumes a non-native application using C#/C++. If you did develop a client mobile application natively you would have access to the necessary image libraries (GD) to compress the images (without resizing them) that you wish.

Community
  • 1
  • 1
jas-
  • 1,801
  • 1
  • 18
  • 30