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

前端之家收集整理的这篇文章主要介绍了jquery – 在rails 3升级后重新定位时出现回形针错误前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
我有回形针工作上传和保存图像的不同样式但是当我使用来自railscasts教程的jcrop来裁剪图像时它不会裁剪图像.我收到这个错误
  1. [paperclip] identify -format %wx%h '/var/folders/z+/z+KzOZBFE9irCpbMKKBGFk+++TI/-Tmp-/paperclip-reprocess20110118-19757-1wtrjaj-0[0]' 2>/dev/null
  2. [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
  3. [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文件如下所示,位于初始化程序目录中

  1. module Paperclip
  2. class Cropper < Thumbnail
  3. def transformation_command
  4. if crop_command
  5. crop_command + super.join(" ").sub(/ -crop \S+/,'')
  6. else
  7. super
  8. end
  9. end
  10.  
  11. def crop_command
  12. target = @attachment.instance
  13.  
  14. if target.cropping?
  15. " -crop #{target.crop_w.to_i}x#{target.crop_h.to_i}+#{target.crop_x.to_i}+#{target.crop_y.to_i}"
  16. end
  17. end
  18. end
  19. end

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

请任何人都可以帮忙吗?

非常感谢
理查德莫斯

解决方法

这是我的工作文件
  1. module Paperclip
  2. class Cropper < Thumbnail
  3. def transformation_command
  4. if crop_command
  5. crop_command + super.join(' ').sub(/ -crop \S+/,'').split(' ') # super returns an array like this: ["-resize","100x","-crop","100x100+0+0","+repage"]
  6. else
  7. super
  8. end
  9. end
  10.  
  11. def crop_command
  12. target = @attachment.instance
  13. if target.cropping?
  14. ["-crop","#{target.crop_w}x#{target.crop_h}+#{target.crop_x}+#{target.crop_y}"]
  15. end
  16. end
  17. end
  18. end

猜你在找的jQuery相关文章