Pastebin launched a little side project called VERYVIRAL.com, check it out ;-) Want more features on Pastebin? Sign Up, it's FREE!
Guest

Untitled

By: a guest on Jun 21st, 2012  |  syntax: Rails  |  size: 0.55 KB  |  views: 9  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  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
clone this paste RAW Paste Data