我这样做的当前方式是这样的:
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
我们都知道操作不是用于这种目的,我已经尝试过几个小时试图通过MiniMagick直接打开文件但它存储在GridFS中我找不到直接打开它的方法,有没有更好的这样做的方法?