Ruby on rails 在Carrierwave中获得图像几何体是否有比通过操纵黑客更好的方法?
我目前的做法是:Ruby on rails 在Carrierwave中获得图像几何体是否有比通过操纵黑客更好的方法?,ruby-on-rails,carrierwave,Ruby On Rails,Carrierwave,我目前的做法是: def avatar_geometry width = 0 height = 0 self.avatar.manipulate! do |img| # this is kind of a hack, we're actually not manipulating anything here, we just # need access to imagemagick @width = img[:width]
def avatar_geometry
width = 0
height = 0
self.avatar.manipulate! do |img|
# this is kind of a hack, we're actually not manipulating anything here, we just
# need access to imagemagick
@width = img[:width]
@height = img[:height]
img
end
{:height => @height, :width => @width}
end
我们都知道Operation不用于这种目的,我尝试了几个小时试图通过MiniMagick直接打开文件,但它存储在GridFS中,我找不到直接打开它的方法,有更好的方法吗?这个元数据插件怎么样?