docs: def _set_image(self, image):
          """
          Set the image for this file.
  
          This also caches the dimensions of the image.
          """
          if image:
              self._image_cache = image
              self._dimensions_cache = image.size
          else:
              if hasattr(self, '_image_cache'):
                  del self._cached_image
              if hasattr(self, '_dimensions_cache'):
                  del self._dimensions_cache