为摄影师量体裁衣. 支持RAW源文件格式, 以及EXIF 属性显示.
安全. 所有媒体资源以 cookie-token保护, 密码哈希保存, API 遵守 CORS政策：
Photo gallery for self-hosted personal servers
Photoview is a simple and user-friendly photo gallery that's made for photographers and aims to provide an easy and fast way to navigate directories, with thousands of high-resolution photos.
You configure Photoview to look for photos and videos within a directory on your file system. The scanner automatically picks up your media and start to generate thumbnail images to make browsing super fast.
When your media has been scanned they show up on the website, organised in the same way as on the filesystem.
If you have questions regarding setup or development, feel free to join the Discord server https://discord.gg/jQ392948u9
Username: demo Password: demo
- Closely tied to the file system. The website presents the images found on the local filesystem of the server, directories are mapped to albums.
- User management. Each user is created along with a path on the local filesystem, photos within that path can be accessed by that user.
- Sharing. Albums, as well as individual media, can easily be shared with a public link, the link can optionally be password protected.
- Made for photography. Photoview is built with photographers in mind, and thus supports RAW file formats, and EXIF parsing.
- Video support. Many common video formats are supported. Videos will automatically be optimized for web.
- Face recognition. Faces will automatically be detected in photos, and photos of the same person will be grouped together.
- Performant. Thumbnails are automatically generated and photos first load when they are visible on the screen. In full screen, thumbnails are displayed until the high resolution image has been fully loaded.
- Secure. All media resources are protected with a cookie-token, all passwords are properly hashed, and the API uses a strict CORS policy.
- Arch Linux Aur
- EmbassyOS: announcement, repo
Why yet another self-hosted photo gallery
There exists a lot of open-source self-hosted photo galleries already. Here are some, just to mention a few.
So why another one? I love taking photos, and I store all of them on my local fileserver. This is great because I can organize my photos directly on the filesystem so it's easy to move them or take backups. I want to be able to control where and how the photos are stored.
The problem is however that RAW images are extremely tedious to navigate from a fileserver, even over the local network.
My server holds a lot of old family pictures, that I would like my family to have access to as well. And some of the pictures I would like to easily be able to share with other people without the hassle of them having to make an account first.
Thus I need a solution that can do the following:
- A scan based approach that automatically organises my photos
- Support RAW and EXIF parsing
- Have support for multiple users and ways to share albums and photos also publicly
- Be simple and fast to use
All of the photo galleries can do a lot of what I need, but no single one can do it all.
Set up development environment
- Install a local mysql server, and make a new database
.envand update the
Start API server(backend)
Make sure golang is installed.
Some C libraries are needed to compile the API, see go-face requirements for more details. They can be installed as shown below:
# Ubuntu sudo add-apt-repository ppa:strukturag/libheif sudo add-apt-repository ppa:strukturag/libde265 sudo apt-get update sudo apt-get install libdlib-dev libblas-dev libatlas-base-dev liblapack-dev libjpeg-turbo8-dev libheif-dev # Debian sudo apt-get install libdlib-dev libblas-dev libatlas-base-dev liblapack-dev libjpeg62-turbo-dev libheif-dev # macOS brew install dlib libheif
Then run the following commands:
cd ./api go install go run server.go
Start UI server(front end)
Make sure node is installed. In a new terminal window run the following commands:
cd ./ui npm install npm start
The site can now be accessed at localhost:1234. And the graphql playground at localhost:4001
This guide explains how to build, install and configure Photoview on a fresh installation of
Ubuntu 20.04 LTS to run directly on the system without using Docker.
Make sure you got the necessary tools and libraries in order to build and run Photoview.
# Make sure your computer is up to date
$ sudo apt update
$ sudo apt upgrade
# Install tools used in this guide
$ sudo apt install git curl wget
# Install necessary repositories
$ sudo apt install software-properties-common
$ sudo add-apt-repository ppa:strukturag/libheif
$ sudo add-apt-repository ppa:strukturag/libde265
# Install dependencies required to build and run Photoview
$ sudo apt install libdlib-dev libblas-dev libatlas-base-dev liblapack-dev libjpeg-turbo8-dev build-essential \
libdlib19 libdlib-dev libblas-dev libatlas-base-dev liblapack-dev libjpeg-dev libheif-dev pkg-config gpg
Install Golang by following the instructions for Linux from their Download and install Go page, the steps should be something like the following.
# Download Go
$ wget https://golang.org/dl/go1.16.linux-amd64.tar.gz
# Install Go
$ sudo tar -C /usr/local -xzf go1.16.linux-amd64.tar.gz
$ rm go1.16.linux-amd64.tar.gz
# Add Go to the path of your user
$ echo 'export PATH=$PATH:/usr/local/go/bin' >> "$HOME/.bashrc" && source "$HOME/.bashrc"
# Verify that go is now installed
$ go version
# Expected output: go version go1.16 linux/amd64
Now install Node 16 and NPM if you've not done so already (it installs npm automatically)
$ curl -fsSL https://deb.nodesource.com/setup_16.x | sudo -E bash -
$ sudo apt install nodejs
Download and build Photoview
Navigate to Photoview Releases and download the source code for the latest version, extract it and open the extracted directory in the terminal.
$ cd /opt
$ git clone https://github.com/photoview/photoview.git
$ cd photoview/
Build the Web user-interface
$ cd ui/
$ npm install
$ npm run build
This builds the UI source code and saves it in the
Build the API back-end
$ cd api/
$ go build -v -o photoview .
This builds the server executable to
Copy needed files
Make a new directory and move the needed files to it.
$ cd /opt/photoview
$ mkdir app
$ cp -r ui/build/ app/ui/
$ cp api/photoview app/photoview
$ cp -r api/data/ app/data/
It's highly recommended to configure a full database, but Sqlite is also supported though it might be substantially slower on big media libraries. If you decide to use Sqlite, you can skip this step.
If you don't already have a database you can configure one by following this guide on installing MySQL on Ubuntu 20.04.
If you've not done already, configure a new database and user to use with Photoview.
$ sudo mysql
# Create new user named 'photoview'
mysql> CREATE USER 'photoview'@'localhost' IDENTIFIED BY 'Photo_Secret#12345';
# Create new database named 'photoview'
mysql> CREATE DATABASE photoview;
# Grant user full access to the newly created database
mysql> GRANT ALL PRIVILEGES ON photoview.* TO 'photoview'@'localhost';
This will create a new user
photoview with the password
Photo_Secret#12345 and a new database named
When you're done you should have a running MySQL database with a new user identified by a username and password and an empty database.
Photoview is configured through environment variables. It will also load environment variables from a
.env file. We will use that to configure Photoview.
api/example.env file to the output directory, and name it
$ cp api/example.env app/.env
To configure the database to use our MySQL database, edit
PHOTOVIEW_MYSQL_URL to match our database configuration. Replace
PHOTOVIEW_DATABASE_DRIVER=mysql PHOTOVIEW_MYSQL_URL=user:password@tcp(localhost)/dbname PHOTOVIEW_SERVE_UI=1 PHOTOVIEW_PUBLIC_ENDPOINT=http://localhost:4001/
See environment variables for more details.
Install optional dependencies
Photoview can use some external programs to do more advanced things, these programs are not required to use Photoview but some functionality will only be avaliable with them installed.
RAW photo support
Photoview can use Darktable to convert RAW photos to JPEGS when scanning. To enable this install Darktable and make sure the
darktable-cli binary is in your
$PATH environment variable.
$ sudo apt install darktable
Photoview can use
ffmpeg to convert video files that cannot be played directly in the browser.
$ sudo apt install ffmpeg
Photoview can optionally use
exiftool to parse EXIF metadata faster and more reliably. Without it it will use its internal exif parser.
$ sudo apt install exiftool
If you've made it this far, you should be able to start Photoview. (Skip this step if you are using the
systemd unit file.)
Once it has started it should print something like the following. (If using the
systemd unit, this message should be visible in the output of the
systemctl status command.)
Photoview UI public endpoint ready at http://localhost:4001/
Navigate to http://localhost:4001/ and you should be presented with the "Initial Setup" wizard. From here enter a new username and password. For the
Photo Path enter the filepath for your media, you can always change this later from the settings.
Setup Photoview to create the new admin user.
Now navigate to the Settings page and click on Scan All. The scanner should now begin to scan for new media.