– Work in Progress –


I want to have all taken pictures during the night to be synchronized to a remote server so that they can be displayed in a nice web photo gallery. I also wanted to have a folder per usage (each time people would take pictures) so that after each usage of the photobooth, you could scan a QR code and go to a web gallery displaying the pictures it just took of you.

People would then be able to go to the full gallery (all pictures, taken and generated) or to their specific session of the booth (displaying the X pictures taken and the generated one).

Big pictures.

Process is simple:

  • After generating and printing the pictures, pimaton via its sync options will copies images to a remote server.
  • On the remote server, a cron is running every 2 minutes to parse that directory.
    • The cron parse the directories and create “session” directories (per usage) and symlink pictures in them.
    • The cron finishes by generating the new ouput of the gallery in the right directory serve by nginx.

I didn’t want to duplicate the wheel for the web gallery and I knew a lot of opensource tools already existed for this. Thus based on the following requirements:

  • No database/install, just directory reading
  • Follow symlink (at least for images, so I can have a “all” folder and a folder per “run” without duplicating the images and loose disk space)
  • Scriptable (so i can run a script first that filter images in the right directory and create symlinks, and then generate the gallery rendering)
  • responsive (almost 100% traffic will come from phone during the night.

So after a quick look, my choice went to sigal, which seemed simple yet powerfull :)

Ok! Let’s go!

In this example, my web gallery is located at https://gallery.url, update configuration accordingly :).

Pimaton configuration

Pimaton provide 5 entries in its config file about QR code.

2 regarding displaying the QR code in the GUI:

In the “gui” area:

# Display a QR code that links to this url.
qr_code_link_to_site: 'http://gallery.url'
# Display a text bellow the QR code.
# Will be displayed only if QR code above is enabled.
qr_code_bellow_text: "Find all pictures on https://gallery.url\nOr by scanning the QR code above."

The first item is a URL. If not empty, a QR code linking to this URL will be displayed on the waiting screen.
If that’s the case, the text of the second variable will be displayed bellow the QR code if not empty. See below for example:

If you put a URL and a text, it will look like this:

Gui with QR code

3 for adding a QR code to the generated and printed image:

In the “image → print_pic” section:

    # If a QR code direct to the session gallery should be printed.
    qr_code_enabled: false
    # The link to the gallery. %%uuid%% will be modified with the unique identifier.
    qr_code_session_link: "http://gallery.url/sessions/%%uuid%%/"
    # Change the size of the QR code. Be carreful with this option, change only if you have changed the default number of picture per genrated image.
    qr_code_size: 6

First option is to enable the QR code to be printed. 2nd is about the url to link to. If like me you want ot link to the specific folder, you have the option of playing with the unique identifier of each pimaton run in the URL.
In my case, i’ll have a global “sessions” folder containing all run and their associated pics (symlinked from the “all” directory).

Below you can see the printed picture:

Pimaton generated picture with QR code

Configure your RaspberryPi.

Once it’s done, make sure that pimaton can reach that remote server and can be connected via ssh.

For this, just generate an ssh-key witout passphrase on pimaton:


and leave empty the passphrase.

Then copy the file (~/.ssh/id_rsa.pub) into the ~/.ssh/authorized_keys on the remote server.

Now you should be able to ssh without password:

ssh login@yourserver

If it works, you can continue :).

Remote server configuration.

On the remote server, install sigal:

pip install sigal

On a RaspberryPi, I had to install before:

sudo apt install libtiff-dev libjpeg-dev zlib1g-dev libfreetype6-dev liblcms2-dev libwebp-dev tcl8.5-dev tk8.5-dev

Create the script that will run every 2 min. I called it pimaton_gallery.sh

disclaimer: This is a very quick and dirty script I tried as a proof of concept. This should be improved and make more configurable.


# Directory where the pictures are sync from pimaton
cd /home/pi/pimaton_pictures

if [ ! -d "./generated" ]; then
  mkdir "./generated"

if [ ! -d "./_all" ]; then
  mkdir "./_all"

mv madwin_*.jpg ./_all/
mv pimaton_*.jpg ./generated/

for F in $(ls ./generated/*.jpg)
  ID=$(echo "$F" | awk -F '_' '{print $2}')

  if [ ! -d "./sessions/$ID" ]; then
    mkdir -p "./sessions/$ID"
    cd ./sessions/"$ID"
    ln -s ../../_all/*"$ID"*.jpg .
    cd ../../


/usr/local/bin/sigal build -c /home/pi/sigal.conf.py > /dev/null 2>&1

Configure cron to run this script every 2 minutes:

crontab -e
# then enter at the end of the file:
*/2 * * * * /bin/bash /home/pi/pimaton_gallery.sh

Of course, you need to adapt this if the script is located elsewhere.

In my case, I’m using nginx to serve the html files, with an http authentication. You can obviously use any http server here.

My nginx configuration, with https (managed by let’s encrypt):

server {
    listen 80;
    server_name gallery.url;

    location /.well-known/acme-challenge {
        root /var/www/html/gallery.url/;
        index index.html;

    location / {
        return 301 https://$host$request_uri;

server {
    listen 443 ssl;
    server_name gallery.url;

    location /.well-known/acme-challenge {
        root /var/www/html/gallery.url/;
        index index.html;

    ssl_certificate /etc/nginx/certs/live/bacardi55.org/fullchain.pem;
    ssl_certificate_key /etc/nginx/certs/live/bacardi55.org/privkey.pem;

    ssl_dhparam /etc/nginx/certs/dhparam.pem;

    ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
    ssl_prefer_server_ciphers on;
    ssl_session_timeout 1d;
    ssl_session_cache shared:SSL:50m;
    ssl_stapling on;
    ssl_stapling_verify on;
    add_header Strict-Transport-Security max-age=15768000;

    ssl on;
    root /var/www/html/gallery.url/;
    index index.html;
    auth_basic Protected;
    auth_basic_user_file /etc/nginx/conf.d/.htpasswd; 

Try to go to the gallery to make sure everything is working fine :).

Now it should be good, just run pimaton and see your pictures are synchronized and your gallery well generated :).
Sigal is responsive and will work great on mobile phone of the user during the night.

Next: Part6: Creating the final box
Previous: Part4: Optional configuration