code: def save(self, *args, **kwargs):
          
          img = self.image
          # Check if this is an already existing photo
          try:
              old_self = self.__class__.objects.get(id=self.id)
          except ObjectDoesNotExist:
              old_self = None
          #  Run on new and changed images:
          if self.id is None or self.thumb is None or (old_self.image != img):
              try:
                  height = img.height
                  width = img.width
              except Exception as error:
                  # We aren't dealing with a reliable image, so....
                  #print("Error getting image height or width: {}".format(error))
                  return
              # If image is vertical or square (treated as vertical)...
              if height >= width:
                  self.is_vertical = True
              if width > 900 or height > 1200:
                  """
                  The image is larger than we want.
                  We're going to downsize it BEFORE it is saved,
                  using PIL on the InMemoryUploadedFile.
                  """
                  image = Image.open(img)
                  image.resize((900, 1200), Image.ANTIALIAS)
                  image.save(img.path)
              try:
                  ezthumb_field = get_thumbnailer(self.image)
                  self.thumb = ezthumb_field.get_thumbnail({
                      'size': (80, 80),
                      'crop': ',-10'
                  }).url.replace("\\", "/")
              except Exception as error:
                  print("Error thumbnailing {}: {}".format(self.id, error))
          super(ContentImage, self).save(*args, **kwargs)
docs: We want to do dimension checks and/or resizing BEFORE the original image is saved.
          Note that if we can't get image dimensions, it's considered an invalid image
          and we return without saving.
          If the image has changed, sets self.thumb to None, triggering post_save thumbnailer.