def valid_dimensions if file.path[-3,3] == 'swf' header = SwfFile::FlashFile.header file.path width = header.width height = header.height else dimensions = ImageSize.path(file.path).size width = dimensions[0] height = dimensions[1] end 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)) errors.add :base, "error" end end