def __init__(self, path, upload_to=None, preview_w=None, preview_h=None):
        self.upload_to = upload_to
        self.preview_width = preview_w
        self.preview_height = preview_h
        self.metadata = {}

        if not path:
            self.name = None
            return

        if '%' in path:
            path = urlunquote_plus(path)

        if path.startswith(settings.MEDIA_URL):
            # Strips leading MEDIA_URL, if starts with
            self._path = get_relative_media_url(path, clean_slashes=False)
        elif re.search(r'^(?:http(?:s)?:)?//', path):
            # url on other server? download it.
            self._path = self.download_image_url(path)
        else:
            abs_path = get_media_path(path)
            if os.path.exists(abs_path):
                self._path = get_relative_media_url(abs_path)

        if not self._path or not os.path.exists(os.path.join(settings.MEDIA_ROOT, self._path)):
            self.name = None
            return

        super(ImageFile, self).__init__(self._path)

        if self:
            self.preview_image = self.get_for_size('preview')
dataset/ETHPy150Open theatlantic/django-cropduster/cropduster/files.py/ImageFile.__init__/original