jquery – 在rails 3升级后重新定位时出现回形针错误

我有回形针工作上传和保存图像的不同样式但是当我使用来自railscasts教程的jcrop来裁剪图像时它不会裁剪图像.我收到这个错误
[paperclip] identify -format %wx%h '/var/folders/z+/z+KzOZBFE9irCpbMKKBGFk+++TI/-Tmp-/paperclip-reprocess20110118-19757-1wtrjaj-0[0]' 2>/dev/null
[paperclip] convert '/var/folders/z+/z+KzOZBFE9irCpbMKKBGFk+++TI/-Tmp-/paperclip-reprocess20110118-19757-1wtrjaj-0[0]' -crop 28x32+13+15-resize "400x400>" '/var/folders/z+/z+KzOZBFE9irCpbMKKBGFk+++TI/-Tmp-/paperclip-reprocess20110118-19757-1wtrjaj-020110118-19757-1a5n558-0.jpg' 2>/dev/null
[paperclip] An error was received while processing: #<Paperclip::PaperclipError: There was an error processing the thumbnail for paperclip-reprocess20110118-19757-1wtrjaj-0>

这是在rails 2.3.9中工作,但是hvae刚刚升级到rails 3.0.3我已经获得了所有最新的宝石等.

cropper.rb文件如下所示,位于初始化程序目录中

module Paperclip
  class Cropper < Thumbnail
    def transformation_command
      if crop_command
        crop_command + super.join(" ").sub(/ -crop \S+/,'')
      else
        super
      end
    end

    def crop_command
      target = @attachment.instance   

      if target.cropping?
        " -crop #{target.crop_w.to_i}x#{target.crop_h.to_i}+#{target.crop_x.to_i}+#{target.crop_y.to_i}"
      end
    end
  end
end

尺寸正在进入这个但实际上没有裁剪图像.

请任何人都可以帮忙吗?

非常感谢
理查德莫斯

解决方法

这是我的工作文件
module Paperclip
  class Cropper < Thumbnail
    def transformation_command
      if crop_command
        crop_command + super.join(' ').sub(/ -crop \S+/,'').split(' ') # super returns     an array like this: ["-resize","100x","-crop","100x100+0+0","+repage"]
      else
        super
      end
    end

    def crop_command
      target = @attachment.instance
      if target.cropping?
        ["-crop","#{target.crop_w}x#{target.crop_h}+#{target.crop_x}+#{target.crop_y}"]
      end
    end
  end
end

相关文章

页面搜索关键词突出 // 页面搜索关键词突出 $(function () {...
jQuery实时显示日期、时间 html: &lt;span id=&quot...
jQuery 添加水印 &lt;script src=&quot;../../../.....
中文:Sys.WebForms.PageRequestManagerParserErrorExceptio...
1. 用Response.Write方法 代码如下: Response.Write(&q...
Jquery实现按钮点击遮罩加载,处理完后恢复 思路: 1.点击按...