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.3.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5e9ade8c4d6eb7b560cb79b3d41c415e7f3ba41ee1e4a090391bb76f0f31b9b0 |
|
MD5 | 727bf2cc26913c61a7e634a84d526513 |
|
BLAKE2b-256 | f9875e386c53b20a8b6ccba665c70a622ebd60703975ae4582d4355a70bf9eaf |
Close
Hashes for django_webcampicture-0.1.3-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0a4c2d5154cde3638030c6f543298fe03363e4a0129d08fd20ea1afaf0bcfb71 |
|
MD5 | 369df8c17654ae55dab40603d2bf4b68 |
|
BLAKE2b-256 | 5df7a0442b55fc83d9ff2b79bf45bbecfae1cf8d13afd56103e103947ec94241 |