automatically identify ad type

This commit is contained in:
albert
2011-12-21 18:41:17 -05:00
parent 5e3b243b67
commit 67448d4636
4 changed files with 10 additions and 5 deletions

View File

@@ -50,6 +50,12 @@ class Advertisement < ActiveRecord::Base
image_size = ImageSize.new(File.open(image_path, "rb"))
self.width = image_size.get_width
self.height = image_size.get_height
if width > height
self.ad_type = "horizontal"
else
self.ad_type = "vertical"
end
end
end