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=360, 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.9.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | cf3ed8acad7f9d112a06a7d58619bea510fbec414675ebd781a3f24bed30f497 |
|
MD5 | 098b665d49d15c646ddc6b61d8b801ed |
|
BLAKE2b-256 | 8bb5e5fa9a776d88ba712a08b4c864bcf091c3757488dd26450773b08cd96174 |
Close
Hashes for django_webcampicture-0.1.9-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2e590c73af91b36cfd154c6175b2eccdae0a5450340af5d0dc3a1904103f2ee2 |
|
MD5 | fbe891b4681aa36e2b3c92d88c767011 |
|
BLAKE2b-256 | c1c55b645c448794e7f8619948adae9db0128cf93b32b7b4db516097ff25a1da |