A small django application for generating small colourful icons for users profile pictures
Project description
django-initialcon is a small django application for generating small colourful icons for users profile pictures. Project is hosted on Github https://github.com/bettsmatt/django-initialcon
Quick start
Install using PIP:
pip install django-initialcon
Add ‘initialcon’ to INSTALLED_APPS:
INSTALLED_APPS = { ... 'initialcon', }Include the initialcon URLconf in __init__.py:
url(r'^initialcon/', include('initialcon')),Add font config to your settings.py:
INITIALCON_FONTS = { 'default': <pathtofont>), 'alt': <pathtofont>) }Run the development server and test everything works by accessing http://127.0.0.1:8000/initialcon/test%20name
Configuration
Along with the fonts used the default size, maximum size and colors can be set by adding the following to your settings.py.:
INITIALCON_SIZE = 100
INITIALCON_SIZE_MAX = 200)
INITIALCON_COLORS = [
(153,180,51), (0,163,0), (30,113,69), (255,0,151), (45,137,239),
(159,0,167), (0,171,169), (185,29,71),(227,162,26), (255,196,13),
(126,56,120), (96,60,186), (43,87,151), (218,83,44), (238,17,17)
]
INITIALCON_FONTS = {
'default': <pathtofont>),
'alt': <pathtofont>)
}
Example URLs
Basic:
localhost:8000/initialcon/test%20name
Custom size:
localhost:8000/initialcon/test%20name?size=200
Custom font:
localhost:8000/initialcon/test%20name?font=alt
Custom size and font:
localhost:8000/initialcon/test%20name?size=200&font=alt
Example code
Template:
<img src="{{img.getImage}}" />
Code:
class MyModel(model.Models):
image = ...
name = ...
def getImage(self):
if self.image:
...
else:
return reverse('initialcon:generate', args=[self.name])
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
File details
Details for the file django-initialcon-0.1.6.tar.gz.
File metadata
- Download URL: django-initialcon-0.1.6.tar.gz
- Upload date:
- Size: 14.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4011dda1141fa07ff2b6a7af0d19e66a9425d1770c6ec57e2e790a631b6b6ebf
|
|
| MD5 |
4c2de8a13fa94c1786739787501fc9ae
|
|
| BLAKE2b-256 |
b9839bb2d03a83149dfba67201fe201707a67c7f715345179f59c9669853d7d1
|