EGreg / Platform-history

The Qbix Platform for powering Social Applications
http://qbix.com/platform
GNU Affero General Public License v3.0
21 stars 5 forks source link

Compress images before upload #2

Closed EGreg closed 10 years ago

EGreg commented 10 years ago

Right now, when uploading images, there is too much latency and too much bandwidth is wasted, especially on mobile phones.

The "Q/imagepicker" should also have a "compress" option, which would be true by default. In all browsers that can support it, if this option is set, the images (after the crop) will be compressed to the largest size that needs to be sent to the server.

If the "x" size is requested, then the image is not compressed before being uploaded. The largest required width is calculated. "80x" means 80 width regardless of height. The largest required height is calculated. "x80" means 80 height regardless of width. Then the aspect ratio is taken into account to determine the largest size of the image that needs to be the server. The largest size has the width and height in the same aspect ratio as the original (or cropped) image's width and height.

Recall that the "crop" option is unset if the cropping was done in the browser (see https://github.com/EGreg/Q/issues/1) but otherwise, all fields of the "crop" option should remain the same, and not proportionally scaled down.

glebv commented 10 years ago

implemented, close