代码之家  ›  专栏  ›  技术社区  ›  tybro0103

将现有图像调整为回形针和RMagick中的新样式

  •  60
  • tybro0103  · 技术社区  · 16 年前

    2 回复  |  直到 16 年前
        1
  •  89
  •   Robert Speicher    16 年前

    你想要那个 reprocess! 回形针的方法:附件。看到了吗 the docs .

    class User < ActiveRecord::Base
      has_attached_file :avatar, :styles => { :medium => "300x300>", :thumb => "100x100>" }
    end
    
    # Console...
    >> User.find_each { |u| u.avatar.reprocess! }
    

    还有,根据之前的评论 再加工! 方法,有一个paperclip:refresh Rake 任务,可能更简单。

        2
  •  30
  •   Naveed    13 年前

    试试这个回形针提供的耙子任务

    rake paperclip:refresh:missing_styles
    

    https://github.com/thoughtbot/paperclip#post-processing