Files changed (11)
+ The idea is to generate thumbnails of external URLs. SORL does brilliant generation of thumbnails, but it does not
+ work with external URLs. So we need to have a template tag, which will download an image and return its' relative
+ * Before downloading the image given - check first if it does not exist in the system yet and not new (we can
+ Alternatively, you may copy the eximagination directory to your project directory or install it in your virtual
+ Make sure to have the right path to media root defined in eximagination specific constants (either in defaults.py
+ description=("Eximagination package for copying external images in tempalate tags and storing them locally."),
Empty file added.
+ Gets an image from absolute url and saves it locally. Checks wheither image already exists in local directoru
+ and only if not - tries to download it and saves it. Validates validity of the image (relying on PIL Image
+ # First we check if any image with such name (without extention) exists in our local external images directory.
+ filename = os.path.basename(glob.glob(os.path.join(save_to, hashlib.md5(image_source).hexdigest()) + '.*'))
+ # Loading the file of unknown type into memory. We don't save the image locally before it's validated.
+ # Loading into PIL image in order to check if image is a proper image as well as to detect its' extention.
+ # This is probably the best way to validate the image and get its' extention, since PIL Image throws an
+ if os.path.exists(filename_full_path) and os.path.isfile(filename_full_path) and not force_update: