回形针和S3:多个缩略图尺寸不节能 [英] Paperclip and S3: Multiple thumbnail sizes not saving

查看:174
本文介绍了回形针和S3:多个缩略图尺寸不节能的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我用回形针来处理我的Rails应用程序图片上传,当我使用的系统存储它的伟大的工作:多个缩略图的大小(风格,在回形针说法)被保存到文件,我可以访问任何人通过将样式名称的URL方法。

I'm using Paperclip to handle image uploads for my Rails app, and it's working great when I use system storage: multiple thumbnail sizes ("styles" in Paperclip parlance) are saved to file, and I can access any of them by passing the style name to the url method.

当我设置的应用程序存储在S3图像(使用AWS-S3的宝石),但是,只有一个图像存储在我的S3存储桶。对于它的价值,只有的列在最后的风格被存储。所以,如果在我的模型,我有:

When I set up the app to store images on S3 (using the aws-s3 gem), however, only one image is stored in my S3 bucket. For what it's worth, only the last style listed is stored. So, if in my model, I've got:

  has_attached_file :photo,
                :styles         => { :large  => "1000x1000>", 
                                     :medium => "600x600>", 
                                     :thumb  => "200x200>" },
                :storage        => :s3,
                :s3_credentials => "#{Rails.root}/config/s3.yml",
                :bucket         => AppConstants.bucket,
                :path           => "pictures/:id/:filename"

只有拇指大小将被保存到S3。

Only the "thumb" size will be saved to S3.

有没有人遇到过类似的问题吗?我该如何解决这个问题?

Has anybody encountered a similar problem? How can I fix this?

推荐答案

我不知道为什么这个工程在本地,但没有指定:风格在你的路径声明。

I'm not sure why this works locally, but you didn't specify :style in your path declaration.

这篇关于回形针和S3:多个缩略图尺寸不节能的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆