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.8.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 44c9f07401f1fa0608111eebacceeb36a75c9f913d9e0f12295f2b732aebd047 |
|
MD5 | fa6cc3f35dff1b2a0d20b2681e6cc145 |
|
BLAKE2b-256 | 67d1cb431c011f04e833fba5bd3878bef6d3e954ce212c57d6bf06a6d52b89a6 |
Close
Hashes for django_webcampicture-0.1.8-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | d3fc9e3710c00d609864b570e962a002a8293c20de26d22466c3bbf436864530 |
|
MD5 | aa00ba811c3135c97707d9afcfa976d9 |
|
BLAKE2b-256 | 388e402a15a64cdbea46aad60b16d6bbf762e1ae56627111d8583e9170c63a36 |