From e7b33c807a12627acc469ece3552d443e83a4595 Mon Sep 17 00:00:00 2001 From: Paul Date: Tue, 15 Mar 2011 18:35:05 +0100 Subject: [PATCH] calculating Asset size using rmagick rather than an imagemagick shell command --- app/uploaders/asset_uploader.rb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/uploaders/asset_uploader.rb b/app/uploaders/asset_uploader.rb index fcfd7063..5fa4b766 100644 --- a/app/uploaders/asset_uploader.rb +++ b/app/uploaders/asset_uploader.rb @@ -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