ruby on rails - Getting image dimensions with Carrierwave: undefined method `[]' for nil:NilClass -



ruby on rails - Getting image dimensions with Carrierwave: undefined method `[]' for nil:NilClass -

i trying create different versions of image depending on uploaded image dimensions , don't understand why code not saving width , height values. using carrierwave. code:

class headuploader < carrierwave::uploader::base include carrierwave::rmagick #create different versions of uploaded files: version :thumb process :image_dimensions width = @geometry.width height = @geometry.height if width < height process :resize_to_limit => [30, 60] else process :resize_to_limit => [60, 30] end end def image_dimensions manipulate! |img| @geometry = { width: img.columns, height: img.rows } end end end

for line width = @geometry.width receive next error: undefined method 'width' nil:nilclass

what think problem?

ruby-on-rails ruby-on-rails-4 carrierwave rmagick

Comments

Popular posts from this blog

ruby on rails - Devise Logout Error in RoR -

model view controller - MVC Rails Planning -

php - Working with pretty urls on apache and fastcgi after hhvm installation -