Skip to main content

django-cloudimage

A Django wrapper for https://cloudimage.io

Installation

Install via pip:

pip install django-cloudimage

Usage

  1. Add to INSTALLED_APPS in settings.py 'cloudimage',

  2. Add the CLOUDIMAGE_TOKEN in settings.py

  3. Add the include to urlpatterns in urls.py urlpatterns = [ url(r'^media/', include('cloudimage.urls')), ]

  4. Load the template tag into a template {% load cloudimage %}

  5. Use the image tag. {% image 'path/to/image.jpg' width=100 %} Visit the CloudImage Docs for all of the options. Convert parameters to kwargs.

Options

Cache Control headers

It is highly recommended that if you use this package your site should be sitting behind a CDN. Not sure what this is, check out https://www.cloudflare.com/

Add to settings.py

To set an expiration timeout use an integer in seconds. For example, below the image is set to cache for an hour.

CLOUDIMAGE_CACHE_CONTROL = 3600

This will output Cache-Control max-age=3600 in the response header.

The advanced option

Any string you pass that doesn’t convert to an int will be set in the header.

CLOUDIMAGE_CACHE_CONTROL = "no-cache"

This will output Cache-Control no-cache in the response header.

Caveats

  • KISS

  • The origional image must be accessable via a URL, so RSZ.IO can access it. I use django-storages with AWS S3 to serve my media.

  • This is tested and used in production with Django 1.10 and 1.11 on Python 3.5 and 3.6. But this should work on older versions of Django and Python 2. Open an issue or pull request if not the case.

Versioning

The package is following the Major.Minor.BugFix philosophy. So breaking changes will increase the major number. New features will increase the minor number.

So it is safe to put this line in your requirements.txt

All new features, no breaking features

django-cloudimage>=1.0.0,<2.0

Just bugfixes

django-cloudimage>=1.0.0,<1.1

Release Notes

This project is using GitHub’s release feature. Find the release notes here https://github.com/g3rd/django-cloudimage/releases

Metadata

Release files for django-cloudimage 1.0.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Built distribution (wheel)

Table of built distributions (wheels) for django-cloudimage 1.0.1
File Interpreter ABI Platform
django_cloudimage-1.0.1-py2.py3-none-any.whl Python 3, Python 2 none any Details

Release files / django_cloudimage-1.0.1-py2.py3-none-any.whl

Download URL django_cloudimage-1.0.1-py2.py3-none-any.whl
Size 7.6 kB
Tags Python 2 Python 3
SHA-256 checksum
How to use checksums
bdfb4e3eace713d6560328e71b323ec18338f118fab22dbc675abc9f7b54092e
BLAKE2b-256 checksum
How to use checksums
9f51ce4557693664f47ddc7f2de29690a922d7f6ab00b3f81a5888142a79932d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Security for django-cloudimage 1.0.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

1.0.1 This release

1 release file No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page