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 FileField
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.6.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 53218af77d978b876dc08d4c2685b9452939cc168b68e46beeca7aad4aa85b82 |
|
MD5 | 9c8a8b829312aecdebdf317fcd1fb724 |
|
BLAKE2b-256 | dca43f3bf5127401f8d4e56e83ef1c470080a07b979d8ef9a730a1d1abbf64d6 |
Close
Hashes for django_webcampicture-0.1.6-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | b0038dff0bb1d345cc71d5d94e7e2c2299c7392593882c239be3f17860956494 |
|
MD5 | 0ef69b333c00ebb9f9b6015899ab607a |
|
BLAKE2b-256 | a44adb38da53ebeac75e262c1db94386879bb75f8cbebbb5679184f033dc4466 |