calculating Asset size using rmagick rather than an imagemagick shell command

This commit is contained in:
Paul 2011-03-15 18:35:05 +01:00
parent ebf183c6f6
commit e7b33c807a

View File

@ -54,7 +54,8 @@ class AssetUploader < CarrierWave::Uploader::Base
def set_width_and_height
if model.image?
model.width, model.height = `identify -format "%wx%h" #{file.path}`.split(/x/).collect(&:to_i)
magick = ::Magick::Image.read(current_path).first
model.width, model.height = magick.columns, magick.rows
end
end