Commits

Artur Barseghyan committed f1dc9c4 Draft

better docs

Comments (0)

Files changed (1)

 A Django template tag library which allows downloading of external images right from the template and save it into a
 desired context variable along with `width` and `height` of the image fetched. Caches the fetched images locally.
 
+
+Installation
+-------------------------
+1. Get latest stable version on PyPI:
+
+    $ pip install eximagination
+
+2. Add 'eximagination' to `INSTALLED_APPS` of settings.py:
+
+    >>> INSTALLED_APPS = (
+    >>> # ...
+    >>> 'eximagination',
+    >>> # ...
+    >>> )
+
+3. Make sure to have the right path to media root defined in eximagination specific constants either in settings.py:
+
+    >>> import os
+    >>> PROJECT_DIR = lambda s: os.path.abspath(os.path.join(os.path.dirname(__file__), s).replace('\\','/'))
+    >>> EXIMAGINATION_MEDIA_ROOT = PROJECT_DIR('media/external_images/')
+    >>> EXIMAGINATION_MEDIA_URL = '/media/external_images'
+    >>> EXIMAGINATION_MEDIA_RELATIVE_ROOT = 'external_images/'
+    >>> EXIMAGINATION_DEBUG = True
+
+Usage example
+-------------------------------------
+Somewhere in your Django template:
+
+    >>> {% load eximaginate thumbnail %}
+    >>> {% eximaginate 'http://www.google.com/intl/en/images/logo.gif' %}
+
+    or
+
+    >>> {% load eximaginate thumbnail %}
+    >>> {% eximaginate 'http://www.google.com/intl/en/images/logo.gif' as original %}
+    >>> {% thumbnail original 100x100 %}
+
+In both cases there are two additional context variables added:
+    `ei_width` - Width of the image
+    `ei_height` - Height of the image
+
 :mod:`eximaginate` Module
 -------------------------
 
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.