def should_create_thumbnail(file_path): image = storage.open(file_path) try: Image.open(image) except IOError: return False else: return utils.is_valid_image_extension(file_path)
def should_create_thumbnail(file_path): image_from_url = cStringIO.StringIO(urllib.urlopen(file_path).read()) try: Image.open(image_from_url) except IOError: return False else: return utils.is_valid_image_extension(file_path)
def should_create_thumbnail(file_path): image = default_storage.open(file_path) try: Image.open(image) except IOError: return False else: return utils.is_valid_image_extension(file_path)
def is_image(self): return utils.is_valid_image_extension(self.file_object.name)
def image_verify(file_object): if not utils.is_valid_image_extension(file_object.name): raise utils.NotAnImageException