我正在我的网站上进行一些图像优化。事情在开发机器上工作得很好,但在生产模式下我得到一个错误,即:
ActionView::Template::Error (can't dup Symbol):
这只发生在 aws 的情况下,如果我删除它,那么一切都会正常工作:
我正在使用并且运行良好的代码:
has_attached_file :attachment, {
:styles => {
:medium=>"654x346>",
:small => "260x400>",
:thumb => "75x75#",
:facebook_meta_tag => "200x200#"
}, :include_updated_timestamp => false
}.merge(PAPERCLIP_STORAGE_OPTIONS)
但是现在我修改了它,它在开发环境中工作得很好,但在生产环境中却没有。
has_attached_file :attachment,
:styles => {
:medium => {
:geometry => "654x346>",
:quality => 60,
:format => 'JPG'
},
:small => {
:geometry => "260x400>",
:quality => 60,
:format => 'JPG'
},
:thumb => {
:geometry =>"75x75#",
:quality => 60,
:format => 'JPG'
},
:facebook_meta_tag => {
:geometry =>"200x200#",
:quality => 50,
:format => 'JPG'
}
}.merge(PAPERCLIP_STORAGE_OPTIONS)
其他相关设置:
PAPERCLIP_STORAGE_OPTIONS = {
:storage => :s3,
:s3_credentials => "#{Rails.root}/config/amazons3.yml",
}
amazons3.yml
production:
access_key_id: XXXXxxxXXXXxxx
secret_access_key: XXXXxxxXXXXxxxXXXXxxxXXXXxxxXXXXxxxXXXXxxx
bucket: images.XXXXxxx.com