Comment@russellb almost got me, but not quite right. If you have a Refile :: File called @file, you need to:
fileIO = @file.to_io.to_io
mm = MiniMagick::Image.open(fileIO)
mm.width
mm.height
Yes, two calls to #to_io> ... <The first to_io gives you a Tempfile, which MiniMagick does not want. Hope this helps someone!
- update -
: , (< ~ 20kb, from: ruby-forum.com/topic/106583), to_io, StringIO. , StringIO :
mm = MiniMagick::Image.read(fileio.read)
, :
fileio = file.to_io
if fileio.is_a?(StringIO)
mm = MiniMagick::Image.read(fileio.read)
else
file = fileio.to_io
mm = MiniMagick::Image.open(file)
end