我有回形针工作上传和保存图像的不同样式但是当我使用来自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
原文地址:https://www.jb51.cc/jquery/181041.html
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。