I want my app to be able to tell the difference between a horizontal image and a vertical image, and resize it accordingly when the user uploads it.
I was able to get it working with minimagick but for some reason it does not work the same with Rmagick below is the logic I used for minimagick (in the initializers/carrierwave.rb)
I need to switch to rmagick for some other features I'd like to use
require 'carrierwave/orm/activerecord'
module CarrierWave
module RMagick
def from_orientation(portrait, landscape)
manipulate! do |img|
if img[:width] > img[:height]
width, height = landscape
else
width, height = portrait
end
img.resize "#{width}x#{height}>"
img
end
end
end
end
As you can see i changed the module from minimagick to rmagick I also included the proper gem as well. This is the error i get which makes me wonder what exactly I'm doing wrong:
undefined method `>' for nil:NilClass
This confuses me because the greater than bracket is obviously not a class.
Thank you for all your help in advance!