Django Random Image From Folder is a simple app to load a random image from a specified directory.
Project description
Django Random Image From Folder
Django Random Image From Folder is a simple app to load a random image from a specified directory.
It's trivially simple but I've needed it a few times so I thought maybe others have too.
Installation
Add 'random_image' to INSTALLED_APPS.
Settings
All settings are optional
RANDOM_IMAGE_DIR
Default: Not defined
A path to the directory from which to load the random images. Relative to MEDIA_ROOT.
Note: Passing a path to the template tag will always override the RANDOM_IMAGE_DIR setting.
RANDOM_IMAGE_EXTENSIONS
Default: ['.jpg','.jpeg','.png','.gif']
A list containing extensions to be considered when choosing a random image.
Usage
Pass in a path to the image directory::
{% load random_image %}
<img src="{{ MEDIA_URL}}{% random_image "path/to/image/dir" %}">
The path to the image directory should be relative to MEDIA_ROOT.
or if you have added RANDOM_IMAGE_DIR to your settings file::
{% load random_image %}
That's it! Simple as it gets.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file django-random-image-from-folder-0.0.3.tar.gz.
File metadata
- Download URL: django-random-image-from-folder-0.0.3.tar.gz
- Upload date:
- Size: 2.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.32.2 CPython/3.7.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3514f8409e0e95a5862a729bc6e3354cf5af7d662deb5cd768320378e190d31b
|
|
| MD5 |
71db2b0209509c7770715c02703a6f9b
|
|
| BLAKE2b-256 |
447c07110528631fd33742e6b2f52f24735dfaa8d216e79e513e90054d234192
|
File details
Details for the file django_random_image_from_folder-0.0.3-py3-none-any.whl.
File metadata
- Download URL: django_random_image_from_folder-0.0.3-py3-none-any.whl
- Upload date:
- Size: 3.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.32.2 CPython/3.7.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5323679489c6c3fb50b433cdf57cd1dfe21786dd6b3560050cb7c9d52479dff2
|
|
| MD5 |
28268890ceccd743c9fe8ccbd44a60af
|
|
| BLAKE2b-256 |
c23d842ef51ce7e54cf5e8b7bfd899cd3dc4e06e9cd8451f8890a35bf3d3ad57
|