Skip to content

How to: Get version image dimensions

khelll edited this page Oct 25, 2011 · 16 revisions

Simple trick to get the image dimensions generated by some version:

# in the uploader file

version :show do
  process :resize_to_limit => [500, 500]
  process :get_version_dimensions => :show
end

def get_version_dimensions(version)
  width, height = `identify -format "%wx%h" #{file.path}`.split(/x/) 
end
Clone this wiki locally