Skip to main content

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

  1. Install using pip:
pip install django-webcampicture
  1. Add "webcampicture" to your INSTALLED_APPS setting like this:
INSTALLED_APPS = [
    ...
    'webcampicture',
]
  1. 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
  1. 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

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)

Source distribution for django-webcampicture 0.1.9
File Size Uploaded
django-webcampicture-0.1.9.tar.gz 6.2 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for django-webcampicture 0.1.9
File Interpreter ABI Platform
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

Release history Release notifications | RSS feed

This release

0.1.9 This release

2 release files

0.1.8

2 release files

0.1.7

2 release files

0.1.6

2 release files

0.1.5

2 release files

0.1.4

2 release files

0.1.3

2 release files

0.1.2

2 release files

0.1.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page