图片上传后如何高效处理
这是用于用户头像和用户相册的。我已经开始上传工作,但我需要一些指导:何时执行以下步骤:调整图像大小并使用图像信息更新数据库。
上传由前端服务器上的简单 cgi 脚本处理,而不是由其后面的主应用程序服务器处理,以避免主应用程序服务器与图像上传相关联。
我应该:
在上传脚本中完成文件上传后调整图像大小并使用图像信息更新数据库吗?我担心这可能需要太长时间。
设置一个持久守护进程来监视上传目录并处理调整大小/更新数据库部分。这个很难控制,用户可能无法看到图像,因为守护进程尚未处理它。
其他人如何有效地处理这个问题?
this is for user avatar and users photo albums. I have gotten upload working but i need some guidelines on: when to do the following steps: image resize and update database with image info.
The upload is handled by a simple cgi script on the front-end server instead of the main app server behind it in order to avoid to tie up the main app server with image upload.
should I:
resize the image and update database with image info after finishing file upload in the upload script? my concern is that that may take too long.
setup a persistent daemon to monitor the upload directory and handle the resize/update database part. This one is hard to control and user may not be able to see the image as the daemon has yet to process it.
How do other people handle this efficiently?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
如果执行重新缩放和/或裁剪图像,最好在上传后立即计算结果,以便您可以显示结果以供上传者批准。 ImageMagick 速度相当快:维基媒体使用它在页面显示期间重新缩放图像(如缩略图)。
如果上传需要一段时间怎么办?典型的网络速度会朝该方向降低,因此大多数用户都习惯了速度缓慢。
If rescaling and/or cropping the image is be performed, it's probably best to calculate the result as soon as it has uploaded so you can display the result for the uploader to approve. ImageMagick is pretty speedy: Wikimedia uses it to rescale images (as for thumbnails) during page display.
So what if an upload takes awhile? The typical network speed is decreased in that direction, so most users are used to slowness.