Skip to content
a tiny and very primitive piece of code to show how to use camera in oTree
JavaScript CSS Other
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
__pycache__
_static/global
_static_root
_templates/global
image_upload
Procfile
README.md
db.sqlite3
manage.py
requirements.txt
requirements_base.txt
requirements_server.txt
runtime.txt
settings.py
urls.py

README.md

Photo camera in otree

Based on WebcamJS 1.0 by Joseph Huckaby.

Docs for camera are available here.

An alternative concise and even nicer solution in jQuery can be found here. See more in Danny Markov's tutorial.

On oTree side, the solution is a bit primitive: we put the camera data into a TextField, and then process it decoding from Base64 back to image, and save it in a static folder with the name [photo]+[participant's code].

At the next page the player can delete or keep the photo on server.

You can’t perform that action at this time.