Chilled Geek's Blog

Always curious, always learning

Photo gallery home server (using Piwigo)

Posted at — Dec 1, 2018

Why?

I’ve always used windows photo gallery and have spent a log of time tagging photos to enable easier retrieval of photos for better organisation. I did not want to have my personal photos shared over the internet on the cloud, so looked into building a home server (only accessible via the intranet) where I could access the photos via different devices while at home, and have a centralised location to store our photos. I then came across piwigo which seemed to be a good solution to what I wanted.

General notes on setting up piwigo

The transfer from windows photo gallery to piwigo was not as smooth as I expected, as I realised that after I installed piwigo and started loading photos, even with all the settings set to read as much metadata as possible (using the localfileseditor plugin and changing the php script), the tags that I created in windows photo gallery refused to show up. After some reading around, it seemed like piwigo was not recognising the “xpkeywords” tag. As I wasn’t entirely sure what to do, but needed to preserve all of the precious tag that I spent so much time addeding in the past, I wrote a dirty, slow script to parse the -xpkeywords into iptc keywords using python/exiftools. It was very slow, and the script could probably have been improved massively if I wrote a bash script instead of python + some optimisation, but I only needed to do this once so it wasn’t that much of a problem. What the script did was extract all the -xpkeywords tags, cleaned and relabelled them as iptc keywords, and then piwigo was able to detect the keywords so searching was made easier!

Initially I tried uploading things via sftp, and stored photos in physical albums (i.e. in “galleries”). Currently I’m exploring the use of virtual albums, and it might work well as well, as long as enough metadata/tags are associated to the photos before they are uploaded to the server.

Another point to add is that piwigo seemed to only like folder/filenames with symbols \” - _ \” or alphanumeric characters (i.e. no commas or other symbols), so the script that I wrote above covers for renaming folders to this format to minimise any further errors in loading the data into piwigo.

Install/setup

Prerequisites

Login credentials required The site data is stored in a MySQL database, and dynamic content is processed by PHP

curl -o piwigo.zip http://piwigo.org/download/dlcounter.php?code=latest sudo apt-get install unzip unzip piwigo.zip sudo rsync -avP ./piwigo/ /var/www/html/ (or to /var/www/html/piwigo) rm -r piwigo sudo apt-get install php7.0-mysql php7.0-gd php7.0-curl php7.0-recode sudo service apache2 restart sudo rm /var/www/html/index.html ```

Setup via web browser

Modifying localfileseditor

Add and prepare hard drives for storage

Modify php file size limit