开发者

LocalJumpError from RMagick

on OSX, a Rails 2.3.14 app under Ruby 1.9.2, this (in a model):

img = Magick::Image::read(File.join(image_path)).first
r开发者_StackOverflow社区esized = img.change_geometry("#{new_width}x>")

bombs with this error on that 2nd line:

LocalJumpError (no block given):
  app/models/client_file.rb:186:in `change_geometry'
  app/models/client_file.rb:186:in `resize_image'
  app/controllers/siteman/files_controller.rb:65:in `resize'
  <internal:prelude>:10:in `synchronize'
  /Users/chuckhoffman/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/1.9.1/webrick/httpserver.rb:111:in `service'
  /Users/chuckhoffman/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/1.9.1/webrick/httpserver.rb:70:in `run'
  /Users/chuckhoffman/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/1.9.1/webrick/server.rb:183:in `block in start_thread'


Looks, from the docs, like the function requires a block always, even when the basic resize information is given as a function argument. Which seems horribly inelegant to me, but then, I've never found RMagick to be terribly logical/intuitive with functions like that.

Anyway, the example from the above link looks like it should be enough to get you on a better track. Hope that helps!

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜