A Django app to provide a WebcamPictureField, derived from ImageField.
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
picture = WebcamPictureField("Picture", 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.2.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | ae0bd93998ff7cd8f722027044197e4dbfffc6d08bad6d066285266821c4b5fe |
|
MD5 | 4c870d997729d9aee436c6f287be89b2 |
|
BLAKE2b-256 | 81fcf7d768b1d4555115df158a5c8b49b5d32ffa7b7661fe78fa4ab9b9555626 |
Close
Hashes for django_webcampicture-0.1.2-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 35b984a022d84be1e7f765107d74312356981492b01cd4ed18dc32541379431b |
|
MD5 | 3341964e8ca6e7205aa9cc0cf9c4c7ac |
|
BLAKE2b-256 | 7add2b61c8c2703d860881ca6a029ecc2811613fe863ff2e798efa4d899c4fd8 |