fix unclosed files

windows doesn't like them
This commit is contained in:
Toks
2013-03-29 10:47:18 -04:00
parent 844a077599
commit 79923344d4
2 changed files with 10 additions and 6 deletions

View File

@@ -52,9 +52,11 @@ class Advertisement < ActiveRecord::Base
end
File.chmod(0644, image_path)
image_size = ImageSize.new(File.open(image_path, "rb"))
self.width = image_size.get_width
self.height = image_size.get_height
File.open(image_path, "rb") do |file|
image_size = ImageSize.new(file.read)
self.width = image_size.get_width
self.height = image_size.get_height
end
if width > height
self.ad_type = "horizontal"