回形针锐化处理器导致调整样式不起作用

我正在尝试锐化通过回形针上传的图像。 锐化代码正在工作,但它导致样式不起作用。 代码是这样的:

has_attached_file :photo, :styles => { :thumb => {:geometry => "100x100>"}, :medium => {:geometry => "300x300>"}, :original => {:geometry => "1024x1024>"} }, :processors => [:sharpen], :storage => :s3, :s3_credentials => "#{Rails.root}/config/s3.yml", :path => "/:style/:id/:filename" 

现在,如果我删除处理器选项,则按指定调整上传的图像大小。 但是,如果我包含处理器选项,则所有生成的图像都具有原始大小。

我的锐化处理器看起来像这样:

 module Paperclip class Sharpen < Paperclip::Processor def initialize file, options = {}, attachment = nil super @file = file @current_format = File.extname(@file.path) @basename = File.basename(@file.path, @current_format) end def make dst = Tempfile.new(@basename) dst.binmode command = "#{File.expand_path(@file.path)} -unsharp 1.5×1.0+1.5+0.02 #{File.expand_path(dst.path)}" begin success = Paperclip.run("convert", command) rescue PaperclipCommandLineError raise PaperclipError, "There was an error converting sharpening the image for #{@basename}" end dst end end end 

有什么想法吗?

尝试添加:thumbnail到处理器列表:

 :processors => [:thumbnail, :sharpen] 

默认情况下:thumbnail在那里,但现在您将覆盖该设置。

“可以指定多个处理器,它们将按照它们在:processorsarrays中定义的顺序调用。每个连续的处理器将获得先前处理器执行的结果。所有处理器将接收相同的参数,这就是你的在:styles hash中定义。“