django CMS Image is a plugin for django CMS that allows you to add images on your site.
This addon is compatible with Aldryn and is also available on the django CMS Marketplace for easy installation.
This is a an open-source project. We'll be delighted to receive your feedback in the form of issues and pull requests. Before submitting your pull request, please review our contribution guidelines.
One of the easiest contributions you can make is helping to translate this addon on Transifex.
See REQUIREMENTS
in the setup.py
file for additional dependencies:
- Python 2.7, 3.3 or higher
- Django 1.8 or higher
Make sure django Filer is installed and configured appropriately.
For a manual install:
- run
pip install djangocms-picture
- add
djangocms_picture
to yourINSTALLED_APPS
- run
python manage.py migrate djangocms_picture
Note that the provided templates are very minimal by design. You are encouraged to adapt and override them to your project's requirements.
This addon provides a default
template for all instances. You can provide
additional template choices by adding a DJANGOCMS_PICTURE_TEMPLATES
setting:
DJANGOCMS_PICTURE_TEMPLATES = [ ('background', _('Background image')), ]
You'll need to create the feature folder inside templates/djangocms_picture/
otherwise you will get a template does not exist error. You can do this by
copying the default
folder inside that directory and renaming it to
background
.
The above mentioned example is very helpful if you want to render a background image instead of a normal image. There is another variable available to support such a scenario:
DJANGOCMS_PICTURE_NESTING = True
The default is False
. If set to True
you will be able to add additional
plugins inside the picture plugin. This is helpful if you want to create a
container that holds a background image while adding additional content inside
like text or icons.
You can override the alignment styles through the following setting:
DJANGOCMS_PICTURE_ALIGN = [ ('top', _('Top Aligned')), ]
This will generate a class prefixing "align-". The above written example
would result in class="align-top"
. Adding a class
key to the image
attributes automatically merges the alignment with the attribute class.
We are using the golden ratio to calculate the width or height if any of the values are missing. You can override this using:
DJANGOCMS_PICTURE_RATIO = 1.618
The system is first using the width or height provided by the Thumbnail options followed by Autoscale and finally the Width and Height. We recommend to set width or height values around a placeholder so Autoscale works best:
{% with 720 as width and 480 as height %} {% placeholder content %} {% endwith %}
Further configuration can be achieved through django Filer.
You can run tests by executing:
virtualenv env source env/bin/activate pip install -r tests/requirements.txt python setup.py test