在我的模型中,它使用的是回形针.我添加了
this行代码,但仍无效
has_attached_file :attachment,{ :styles => { :medium => ["654x5000000>",:jpg],:small => ["260x50000000>",:thumb => ["75x75#",:facebook_Meta_tag =>["200x200#",:jpg] },:convert_options => { :medium => "-quality 80 -interlace Plane",:small => "-quality 80 -interlace Plane",:thumb => "-quality 80 -interlace Plane",:facebook_Meta_tag => "-quality 80 -interlace Plane" },:s3_headers => { 'Cache-Control' => 'max-age=315576000','Expires' => 10.years.from_Now.httpdate } }.merge(PAPERCLIP_STORAGE_OPTIONS)
PS:我在GTmetrix.com进行了测试,根据他们的统计数据,亚马逊图像中没有到期标题.
解决方法
为了扩展James对其他人不确定如何重新处理旧附件的回答,有两种方法可以做到:
1)通过rake重新处理所有附件(可选择每个CLASS)
rake paperclip:refresh CLASS=User
2)重新处理特定附件(例如通过迁移)
User.where("attachment IS NOT NULL").find_each do |user| user.attachment.reprocess! end
原文地址:https://www.jb51.cc/ruby/264493.html
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。