我在这里拉头发......我不知道为什么这不起作用。
我正在使用 ruby 1.8.7、rails 3.0.19、回形针 2.7.4。
我的模型:
has_attached_file :photo, :styles => {
:logo => "60x20",
:widget => "60x40",
:thumb=> "100x100",
:small => "150x150>" },
:url => "/images/companies/:id/:style/:basename.:extension",
:path => ":rails_root/public/images/companies/:id/:style/:basename.:extension",
:default_url => "/images/bb_noimage.png"
#validates_attachment_presence :photo
validates_attachment_size :photo, :less_than => 3.megabytes
validates_attachment_content_type :photo, :content_type => ['image/jpeg', 'image/png','image/gif','image/jpg']
在视图中:
<%= image_tag "#{get_image_url(company.id,company.photo_file_name,"small")}"%>
问题是某些文件夹将具有“大”和“拇指”大小,但不会有“小”和“徽标”大小 - 我在很长一段时间没有使用该站点后重新访问该站点。我希望生成缺少的样式。我尝试了这些命令,第一个显示没有错误,但第二个显示下面的错误。Niether 生成所需的缩略图。谢谢您的帮助!
bundle exec rake paperclip:refresh:thumbnails CLASS=Company
bundle exec rake paperclip:refresh:missing_styles --trace
** Execute paperclip:refresh:thumbnails
rake aborted!
No such file or directory - /Users/q/Sites/baiabase-old/public/system/paperclip_attachments.yml
/Users/q/.rvm/gems/ruby-1.8.7-p302@baia-old/gems/paperclip-2.7.4/lib/paperclip/missing_attachment_styles.rb:25:in `initialize'