移动 safari 图片上传 &它们的尺寸 [英] mobile safari image upload & their sizes
问题描述
众所周知,Safari 移动版现在允许通过相机或图片库上传文件.
Ok so as many of know, safari mobile now allows file uploads through camera or image library.
问题"是当从相机拍摄照片时,它会按原样发送,这意味着它的内存非常大(我认为即使在 iphone 4 上也只有 2 或 3 mb).
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).
这使得上传速度非常慢并且消耗带宽(不适用于移动设备).你知道吗,用
html 标签,有没有办法对 iOS 说:嘿,你能不能把图片也压缩一下?"- 就像通过邮件应用发送所述图像时完成的一样.
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.
提前致谢.
推荐答案
有一个库:https://github.com/gokercebeci/canvasResize
它的工作原理是将图像放入 <canvas/>
(小于原始图像),然后获取图像数据,以便您可以将其发布到您的服务器.
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.
这篇关于移动 safari 图片上传 &它们的尺寸的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!