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
- 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.1.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | aefcf29b1c6afc529ba24980fb79202c92e7edaae2c08400f1da82e9bdb7bc22 |
|
MD5 | 0251ae8c13770a2bafb8aa6b734bc1a5 |
|
BLAKE2b-256 | f111fb7a6a9a8315be32cab3d5430ec8027b27dcb3f3425057070409299564c2 |
Close
Hashes for django_webcampicture-0.1.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7fa973030be53f4697d9d31d68596eed9767b6fdc312a2b92e51f10eba8bd5b3 |
|
MD5 | b2a1bf9b29ca8b6ffcd7566581dcbeda |
|
BLAKE2b-256 | 18ca356c28c0c7c0a89d3074cb628e456810ba835a716e7e20bf45087ac14aa7 |