dispatch/modules/content/models.py
def save(self, **kwargs):
        """Custom save method to process thumbnails and save image dimensions."""
        is_new = self.pk is None
        
        if is_new:
            # Make filenames lowercase
            self.img.name = self.img.name.lower()

        # Call super method
        super(Image, self).save(**kwargs)

        if is_new and self.img:
            data = self.img.read()

            if not data:
                return

            image = Img.open(StringIO.StringIO(data))

            self.width, self.height = image.size

            super(Image, self).save()

            name = self.get_name()
            ext = self.get_extension()

            for size in self.SIZES.keys():
                self.save_thumbnail(image, self.SIZES[size], name, size, ext)
def save(self, **kwargs):
        is_new = self.pk is None
        
        if is_new:
            # Make filenames lowercase
            self.img.name = self.img.name.lower()

        # Call super method
        super(Image, self).save(**kwargs)

        if is_new and self.img:
            data = self.img.read()

            if not data:
                return

            image = Img.open(StringIO.StringIO(data))

            self.width, self.height = image.size

            super(Image, self).save()

            name = self.get_name()
            ext = self.get_extension()

            for size in self.SIZES.keys():
                self.save_thumbnail(image, self.SIZES[size], name, size, ext)
def save ( self , * * kwargs ) : is_new = self . pk is None if is_new : # Make filenames lowercase self . img . name = self . img . name . lower ( ) # Call super method super ( Image , self ) . save ( * * kwargs ) if is_new and self . img : data = self . img . read ( ) if not data : return image = Img . open ( StringIO . StringIO ( data ) ) self . width , self . height = image . size super ( Image , self ) . save ( ) name = self . get_name ( ) ext = self . get_extension ( ) for size in self . SIZES . keys ( ) : self . save_thumbnail ( image , self . SIZES [ size ] , name , size , ext )
Custom save method to process thumbnails and save image dimensions.
Custom save method to process thumbnails and save image dimensions .