anmolanand-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org
2008-Oct-08 05:04 UTC
RangeError (bignum too big to convert into `long''
I have written the following function in RoR for my website . The function on execution gives an error for the Rmagick crop method , the error is wriiten after the function . I am using the same function(except for the change in name, rest everything is same) for cropping from left , right and bottom and they are working fine. All the left , right , top and bottomcrop functions are given the same arguments but in case of topcrop these give an error and rest they work fine . FUNCTION: def topcrop(path,cropfile,percentcrop) path = path.chomp cropfile = cropfile.chomp percentcrop = (100-percentcrop.to_i)/100.0 picwidth = 640 ; #width of the pic (in pixels) picheight = 480; #height of the pic (pixels) widthchanged = (picwidth*percentcrop) #new width (based on the percentage specified by the user) heightchanged = (picheight*percentcrop) #new height (based on the percentage of cropping specified by the user) img = Magick::Image.read(path).first #reads the image specfied by the user path img = img.scale(640,480) #scales image to 640x480 img.write"/home/anmol/image.jpg" #scales image to 640x480 img.crop(SouthEastGravity,picwidth,heightchanged).write(cropfile) end ERROR : RangeError (bignum too big to convert into `long''): /app/controllers/crop_controller.rb:98:in `crop'' /app/controllers/crop_controller.rb:98:in `topcrop'' /app/controllers/crop_controller.rb:233:in `updownevent'' /app/controllers/application.rb:74:in `up'' /usr/local/lib/ruby/gems/1.8/gems/actionpack-2.1.1/lib/ action_controller/bas e.rb:1166:in `send'' /usr/local/lib/ruby/gems/1.8/gems/actionpack-2.1.1/lib/ action_controller/bas e.rb:1166:in `perform_action_without_filters'' /usr/local/lib/ruby/gems/1.8/gems/actionpack-2.1.1/lib/ action_controller/fil ters.rb:579:in `call_filters'' /usr/local/lib/ruby/gems/1.8/gems/actionpack-2.1.1/lib/ action_controller/fil ters.rb:572:in `perform_action_without_benchmark'' /usr/local/lib/ruby/gems/1.8/gems/actionpack-2.1.1/lib/ action_controller/ben chmarking.rb:68:in `perform_action_without_rescue'' /usr/local/lib/ruby/1.8/benchmark.rb:293:in `measure'' /usr/local/lib/ruby/gems/1.8/gems/actionpack-2.1.1/lib/ action_controller/ben chmarking.rb:68:in `perform_action_without_rescue'' /usr/local/lib/ruby/gems/1.8/gems/actionpack-2.1.1/lib/ action_controller/res cue.rb:201:in `perform_action_without_caching'' --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Seemingly Similar Threads
- [ win32utils-Bugs-13825 ] /win32-file-stat-1.2.5/lib/win32/file/stat.rb:81:in `at'': bignum too big to convert into `long'' (RangeError)
- Switchtower problem - `sysread'': bignum too big to convert into `long'' (RangeError)
- RangeError problem
- [ win32utils-Bugs-10555 ] wait call in while loop generate "bignum too big to convert into long" error
- [ win32utils-Bugs-10555 ] wait call in while loop generate "bignum too big to convert into long" error