A Django app to provide a WebcamPictureField, derived from FileField.
Project description
django-webcampicture
django-webcampicture is a very simple Django app that provides a specialization of Django's native ImageField
: WebcamPictureField
, which allows users to save images taken from their webcams, instead of uploading.
Quick start
- Install using
pip
:
pip install django-webcampicture
- Add "webcampicture" to your INSTALLED_APPS setting like this:
INSTALLED_APPS = [
...
'webcampicture',
]
- Use the field in your models:
from django.db import models
from webcampicture.fields import WebcamPictureField
class Child(models.Model):
name = models.CharField("Name", max_length=255)
# WebcamPictureField takes the same parameters as ImageField, besides the "width" and "height" positional parameters.
picture = WebcamPictureField("Picture", width=480, height=36-, upload_to="pictures", blank=True)
# Image URL example...
@property
def picture_url(self):
if self.picture and hasattr(self.picture, "url"):
return self.picture.url
- Remember to include in your templates:
{% load static %}
<link rel="stylesheet" href="{% static "webcampicture/css/webcampicture.css" %}">
<script src="{% static 'webcampicture/js/webcampicture.js' %}"></script>
Demo
Settings and default values
WEBCAM_BASE64_PREFIX = "data:image/png;base64,"
WEBCAM_CONTENT_TYPE = "image/png"
WEBCAM_FILENAME_SUFFIX = ".png"
Overridable templates
webcampicture/webcampicture.html
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
Close
Hashes for django-webcampicture-0.1.7.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | ff02da1e52ddd7d7ecf5c8c7fbe0c7070b34091f6ea9ac0a8faa73119bfd7925 |
|
MD5 | 3da280bd5a8f6094d5bbf814d8db4290 |
|
BLAKE2b-256 | ffa04869847824adedcb48e453aed0f827baeddf13317e315bebd57cfc641700 |
Close
Hashes for django_webcampicture-0.1.7-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8a67539e27797f6dbaa2f80e5096ff326a7922dec2a5ef2eb7f44a6d0a45730d |
|
MD5 | 1becd35e32f515163a80bb6466df6e05 |
|
BLAKE2b-256 | aba42539015a791f2d6c346a38d6ef5e8a4a9e78601f9d6759b13d3d5b24cc1d |