Skip to main content

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

https://raw.github.com/bettsmatt/django-initialcon/master/docs/_static/images/p1.png https://raw.github.com/bettsmatt/django-initialcon/master/docs/_static/images/p2.png https://raw.github.com/bettsmatt/django-initialcon/master/docs/_static/images/p3.png https://raw.github.com/bettsmatt/django-initialcon/master/docs/_static/images/p4.png https://raw.github.com/bettsmatt/django-initialcon/master/docs/_static/images/p5.png https://raw.github.com/bettsmatt/django-initialcon/master/docs/_static/images/p6.png https://raw.github.com/bettsmatt/django-initialcon/master/docs/_static/images/p7.png

Quick start

  1. Install using PIP:

    pip install django-initialcon
  2. Add ‘initialcon’ to INSTALLED_APPS:

    INSTALLED_APPS = {
        ...
        'initialcon',
    }
  3. Include the initialcon URLconf in __init__.py:

    url(r'^initialcon/', include('initialcon')),
  4. Add font config to your settings.py:

    INITIALCON_FONTS = {
        'default': <pathtofont>),
        'alt': <pathtofont>)
    }
  5. 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

  1. Basic:

    localhost:8000/initialcon/test%20name
  2. Custom size:

    localhost:8000/initialcon/test%20name?size=200
  3. Custom font:

    localhost:8000/initialcon/test%20name?font=alt
  4. 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 Distributions

django-initialcon-0.1.tar.gz (14.0 kB view details)

Uploaded Source

django-initialcon-0.1.1.tar.gz (14.2 kB view details)

Uploaded Source

File details

Details for the file django-initialcon-0.1.tar.gz.

File metadata

File hashes

Hashes for django-initialcon-0.1.tar.gz
Algorithm Hash digest
SHA256 b5ddcd2c67bb7b16228f0a8e53d0a162128ff523b8669999a4f1f6698a084cdc
MD5 1e357fa2bb21bdd2de129be6752d5f46
BLAKE2b-256 d4d5d9ee15470e86ca32857ad0492049bf4180f5e1ba586ac194aee7056bc965

See more details on using hashes here.

File details

Details for the file django-initialcon-0.1.1.tar.gz.

File metadata

File hashes

Hashes for django-initialcon-0.1.1.tar.gz
Algorithm Hash digest
SHA256 8c0c57f87f13c98650a7b53cd0a8891f6a066d53ef5f6fec8081c704fd5cf406
MD5 0919810e7cd334dd4fbad9a88b636f97
BLAKE2b-256 3cefb8b946a2ab5e46142a97082eb3c4ef99dc1025dcdadb5898b4043abefb14

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page