SHARE
TWEET

Untitled

a guest Jun 21st, 2012 11 Never
  1.   def valid_dimensions
  2.  
  3.     if file.path[-3,3] == 'swf'
  4.       header = SwfFile::FlashFile.header file.path
  5.  
  6.       width = header.width
  7.       height = header.height
  8.     else
  9.       dimensions = ImageSize.path(file.path).size
  10.       width = dimensions[0]
  11.       height = dimensions[1]
  12.     end
  13.  
  14.     unless (width == 600 && height == 200) || (width == 300 && height == 250) || (width == 468 && height == 60) || (width == 728 && height == 90) || (width == 160 && height == 600 || (width == 240 && height == 400))
  15.         errors.add :base, "error"
  16.     end
  17.   end
RAW Paste Data
Top