简体   繁体   English

Rails,Paperclip和S3。 避免保存原始图像?

[英]Rails, Paperclip and S3. Avoid saving the original image?

I am using Paperclip + s3 for image attachment. 我使用Paperclip + s3进行图像附加。 Is there a way to only store the styles and not the original image(in an attempt to reduce attachment save time and save storage space)? 有没有办法只存储样式而不是原始图像(试图减少附件节省时间和节省存储空间)?

I have seen a couple of post which suggest to use original as one of the style. 我看过一些帖子,建议使用原创作为风格之一。 It is not possible for me to do so, as i need the original to act as a reference for cropping. 我不可能这样做,因为我需要原件作为裁剪的参考。 Link to one such post: How do I tell paperclip to not save the original file? 链接到一个这样的帖子: 如何告诉回形针不保存原始文件?

And also it is not possible to save original & delete it later as it kind of defeats the purpose. 并且它也不可能保存原件并在以后删除它,因为它会破坏目的。

Is there a setting which I am missing? 有没有我失踪的环境?

Thank you in advance. 先感谢您。

There's a good resource here: Rails and Paperclip... don't save the original image, just the styles? 这里有一个很好的资源: Rails和Paperclip ...不保存原始图像,只保存样式?

Delayed 延迟

In light of your findings & comment, you may wish to move the image processing to a backend job? 根据您的发现和评论,您可能希望将图像处理移至后端作业? Although I've not done this myself, there are resources such as the delayed_paperclip gem which allow you to push the processing part of Paperclip to a backend job 虽然我自己没有这样做,但有一些资源,例如delayed_pa​​perclip gem ,它允许你将Paperclip的处理部分推送到后端工作


System 系统

A note on system setup - I would personally accomodate the original image. 关于系统设置的说明 - 我个人会接受原始图像。 If you're quibbling over storage space, unless you're facebook or instagram, your image space is not going to cause a big problem, especially considering S3 pricing is based on TB 如果你正在争夺存储空间,除非你是facebook或Instagram,你的图像空间不会造成大问题,特别是考虑到S3定价是基于TB

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM