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
Metadata
Release files for django-webcampicture 0.1.9
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| django-webcampicture-0.1.9.tar.gz | 6.2 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| django_webcampicture-0.1.9-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 14.1 kB
Release files / django-webcampicture-0.1.9.tar.gz
| Download URL | django-webcampicture-0.1.9.tar.gz |
|---|---|
| Size | 6.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
cf3ed8acad7f9d112a06a7d58619bea510fbec414675ebd781a3f24bed30f497
|
|
BLAKE2b-256 checksum How to use checksums |
8bb5e5fa9a776d88ba712a08b4c864bcf091c3757488dd26450773b08cd96174
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.1.8 CPython/3.8.10 Linux/5.11.0-34-generic
|
Release files / django_webcampicture-0.1.9-py3-none-any.whl
| Download URL | django_webcampicture-0.1.9-py3-none-any.whl |
|---|---|
| Size | 7.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
2e590c73af91b36cfd154c6175b2eccdae0a5450340af5d0dc3a1904103f2ee2
|
|
BLAKE2b-256 checksum How to use checksums |
c1c55b645c448794e7f8619948adae9db0128cf93b32b7b4db516097ff25a1da
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.1.8 CPython/3.8.10 Linux/5.11.0-34-generic
|