thumbnails/fields.py
def pre_save(self, model_instance, add):
        """
        Process the source image through the defined processors.
        """
        file = getattr(model_instance, self.attname)

        if file and not file._committed:
            image_file = file
            if self.resize_source_to:
                file.seek(0)
                image_file = processors.process(file, self.resize_source_to)
                image_file = post_processors.process(image_file, self.resize_source_to)
            filename = str(shortuuid.uuid()) + os.path.splitext(file.name)[1]
            file.save(filename, image_file, save=False)
        return file
def pre_save(self, model_instance, add):
        file = getattr(model_instance, self.attname)

        if file and not file._committed:
            image_file = file
            if self.resize_source_to:
                file.seek(0)
                image_file = processors.process(file, self.resize_source_to)
                image_file = post_processors.process(image_file, self.resize_source_to)
            filename = str(shortuuid.uuid()) + os.path.splitext(file.name)[1]
            file.save(filename, image_file, save=False)
        return file
def pre_save ( self , model_instance , add ) : file = getattr ( model_instance , self . attname ) if file and not file . _committed : image_file = file if self . resize_source_to : file . seek ( 0 ) image_file = processors . process ( file , self . resize_source_to ) image_file = post_processors . process ( image_file , self . resize_source_to ) filename = str ( shortuuid . uuid ( ) ) + os . path . splitext ( file . name ) [ 1 ] file . save ( filename , image_file , save = False ) return file
Process the source image through the defined processors.
Process the source image through the defined processors .