photoview

photoview

高性能自托管照片管理工具 支持RAW和面部识别

Photoview是一款高性能的自托管照片管理工具,专为摄影师设计。它支持RAW格式和EXIF解析,自动扫描本地文件并生成缩略图,实现快速浏览。主要特点包括用户管理、相册共享、视频支持和面部识别。Photoview优化性能,支持按需加载高分辨率图像,并采用严格安全策略保护媒体资源,是理想的自托管照片管理解决方案。

Photoview照片管理自托管开源DockerGithub开源项目
<img src="./screenshots/photoview-logo.svg" height="92px" alt="photoview logo" />

License GitHub contributors Docker Pulls Docker builds codecov

screenshot

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 starts 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

Demo site

Visit https://photos.qpqp.dk/

Username: demo Password: demo

Contents

Main features

  • 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.

Supported platforms

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 straightforward and fast to use

All the photo galleries can do a lot of what I need, but no single one can do it all.

Getting started — Setup with Docker

This section describes how to get Photoview up and running on your server with Docker. Make sure you have Docker and docker-compose installed and running on your server. make should be installed as well if you'd like to use provided Makefile, which is optional (see step 4 for more details). 7zz should be installed in case, you'd like to use it in scope of the backup scenario instead of the default .tar.xz format. Read the comment in the Makefile, located on top of the backup section for more details.

  1. Download the content of the docker-compose example folder to the folder on your server, where you expect to host the Photoview internal data (database and cache files).

    Please note that this folder contains 2 versions of the docker-compose file:

    • docker-compose.example.yml - the fully-functional and recommended for the most cases config
    • docker-compose.minimal.example.yml - the minimal and simple config for those, who find the previous one too complex and difficult to understand and manage

    When downloading files, you need to choose only one of them.

  2. Rename downloaded files and remove the example from their names (so, you need to have .env, docker-compose.yml, and Makefile files). If you choose the docker-compose.minimal.example.yml on previous step, make sure to rename it to the docker-compose.yml.

  3. Open these files in a text editor and read them. Modify where needed according to the documentation comments to properly match your setup. There are comments of 2 types: those, starting with ##, are explanations and examples, which should not be uncommented; those, starting with #, are optional or alternative configuration parts, which might be uncommented in certain circumstances, described in corresponding explanations. It is better to go through the files in the next order: .env, docker-compose.yml, and Makefile.

  4. Make sure that your media library's root folder and all the files and subfolders are readable and searchable by other users: run the next command (or corresponding sequence of commands from the Makefile):

    make readable

    If command(s) return Permission denied error, run them under the user, owning corresponding files and folders. Alternatively, run them adding sudo before the command: this will switch the execution context to root user and ask for the root password. You have to have permission to run sudo in the system.

    If you don't want to give required permissions to others group for your files, alternatively, you can:

    • create a group on your host with GID=999 and make all the files and folders inside volumes of the photoview service being owned by this group; then set the appropriate permissions to the group section.
    • create on your host a group with GID=999 and a user in this group with UID=999; then change the ownership of all the files and folders inside volumes of the photoview service to this user; then set the appropriate permissions to the user section.

    If you configured other mounts with media files from other locations on the host (like HOST_PHOTOVIEW_MEDIA_FAMILY or anything else), you need to run the same commands, as in the Makefile readable target, for each media root folder on your host manually: copy each command to your shell and replace the variable with the absolute path to an additional media root folder without the trailing /. Run both commands for each additional root folder.

  5. In case, you don't have make installed in your system or don't want to use it for the Photoview management activities, you could use the same commands from the Makefile and run them in your shell directly, or create your own scripts. Make sure to apply or replace the variables from your .env first in this case. Makefile is provided just for your convenience and simplicity, but is optional.

  6. Start the server by running the following command (or corresponding sequence of commands from the Makefile):

    make all

If the endpoint or the port hasn't been changed in the docker-compose.yml file, Photoview can now be accessed at http://localhost:8000

Initial Setup

If everything is set up correctly, you should be presented with an initial setup wizard when accessing the website the first time.

Initial setup

Enter a new username and password.

For the photo path, enter the path inside the docker container where your photos are located. This can be set from the docker-compose.yml file under photoview -> volumes. The default location is /photos.

A new admin user will be created, with access to the photos located at the path provided under the initial setup.

The photos will have to be scanned before they show up, you can start a scan manually, by navigating to Settings and clicking on Scan All

Advanced setup

We suggest securing the Photoview instance before exposing it outside your local network: even while it provides read-only access to your media gallery and has basic user authentication functionality, it is not enough to protect your private media from malicious actors on the Internet.

Possible ways of securing a self-hosted service might be (but not limited to):

  1. Configure a Firewall on your local network's gateway and allow only the intended type of incoming traffic to pass.
  2. Use VPN to provide external access to local services.
  3. Setting up a Reverse proxy in front of the service and forwarding all the traffic through it, exposing HTTPS port with strong certificate and cipher suites to the Internet. This could be one of the next products or something else that you prefer:
  4. Configure an external Multi-Factor Authentication service to manage authentication for your service (part of Cloudflare services, but you can choose anything else).
  5. Configure Web Application Firewall to protect from common web exploits like SQL injection, cross-site scripting, and cross-site forgery requests (part of Cloudflare services, but you can choose anything else).
  6. Use Content Delivery Network as an additional level of DDoS prevention: it can securely cache your media and let it be accessible from a wide list of servers on the Internet (part of Cloudflare services, but you can choose anything else).
  7. Configure a Rate Limit of allowed number of requests from a user during specified time range to protect against DDoS attacks.
  8. Set up an Intrusion Detection/Prevention System to monitor network traffic for suspicious activity and issue alerts when such activity is discovered.

Setting up and configuring of all these protections depends on and requires a lot of info about your local network and self-hosted services. Based on this info, the configuration flow and resulting services architecture might differ a lot between cases. That is why in the scope of this project, we can only provide you with this high-level list of possible ways of webservice protection. You'll need to investigate them, find the best combination and configuration for your case, and take responsibility to configure everything in the correct and consistent way. We cannot provide you support for such highly secured setups, as a lot of things might work differently because of security limitations.

Contributing

🎉 First off, thanks for your interest in contribution! 🎉

This project is a result of hard work, and it's great to see you interested in contributing. Contributions are not just about code — you can help in many ways!

Before you start, please take a moment to read our Contributing guide. It includes information on our code of conduct, the process for submitting pull requests, and more.

Remember, every contribution counts. Let's make this project better together! 💪

Set up Docker development environment

Docker development environment is easy to set up. It only requires Docker and Docker Compose Plugin locally. All dependencies are installed in a container but not in the host.

It also has some shortcomings. In macOS, Docker is running in a Linux VM. The fs notification doesn't work well in this case. You can't use reflex or nodemon to relaunch servers when code changes. The compiler runs pretty slow too.

We recommend to use Docker development environment. If Docker environment doesn't work well, like on macOS, please use local development environment.

Start API and UI server with Docker Compose

It may take a long time to build dependencies when launching servers first time.

$ docker compose -f dev-compose.yaml build # Build images for development $ docker compose -f dev-compose.yaml up # Launch API and UI servers

The graphql playground can now be accessed at localhost:4001. The site can now be accessed at localhost:1234. Both servers will be relaunched after the code is changed.

By default, it uses sqlite3 as database. To run servers with other database, please update PHOTOVIEW_DATABASE_DRIVER value in dev-compose.yaml file and run:

$ docker compose -f dev-compose.yaml --profile mysql up # Run with mysql database or $ docker compose -f dev-compose.yaml --profile postgres up # Run with postgresql database

Start API server with Docker

If you don't want to depend on Docker Compose but only Docker, you can launch server as below.

It may take a long time to build dependencies when launching servers first time.

$ docker build --target api -t photoview/api . # Build image for development $ docker run --rm -it -v `pwd`:/app --network host --env-file api/example.env photoview/api \ reflex -g '*.go' -s -- go run . # Monitor source code and (re)launch API server

The graphql playground can now be accessed at localhost:4001.

[!NOTE] The server runs on the host network as --network host flag. It's easy to communicate between API server and UI server. If you don't want to do that, please check Docker Network to create a new network to run servers.

Start UI server with Docker

It may take a long time to build dependencies when launching servers first time.

$ docker build --target ui -t photoview/ui . # Build image for development $ docker run --rm -it -v `pwd`:/app --network host --env-file ui/example.env photoview/ui \ npm run mon # Monitor source code and (re)launch UI server

The site can now be accessed at localhost:1234.

[!NOTE] The server runs on the host network as --network host flag. It's easy to communicate between API server and UI server. If you don't want to do that, please check Docker Network to create a new network to run servers.

Set up local development environment

Install dependencies

  • API
    • Required packages:
      • golang >= 1.22
      • g++
      • libc-dev
      • libheif >= 1.15.1
      • go-face Requirements
        • dlib
        • libjpeg
        • libblas
        • libcblas, recommended using libatlas-base
        • liblapack
    • Optional tools during developing:
      • reflex: a source code monitoring tool, which automatically rebuilds and restarts the server, running from the code in development.
      • sqlite: the SQLite DBMS, useful to interact with Photoview's SQLite DB directly if you use it in your development environment.
  • UI
    • Required packages:
      • node = 18

In Debian/Ubuntu, install dependencies:

$ sudo apt update # Update the package list $ sudo apt install golang g++ libc-dev libheif-dev libdlib-dev libjpeg-dev libblas-dev libatlas-base-dev liblapack-dev # For API requirement $ sudo apt install reflex sqlite3 # For

编辑推荐精选

Transly

Transly

实时语音翻译/同声传译工具

Transly是一个多场景的AI大语言模型驱动的同声传译、专业翻译助手,它拥有超精准的音频识别翻译能力,几乎零延迟的使用体验和支持多国语言可以让你带它走遍全球,无论你是留学生、商务人士、韩剧美剧爱好者,还是出国游玩、多国会议、跨国追星等等,都可以满足你所有需要同传的场景需求,线上线下通用,扫除语言障碍,让全世界的语言交流不再有国界。

讯飞智文

讯飞智文

一键生成PPT和Word,让学习生活更轻松

讯飞智文是一个利用 AI 技术的项目,能够帮助用户生成 PPT 以及各类文档。无论是商业领域的市场分析报告、年度目标制定,还是学生群体的职业生涯规划、实习避坑指南,亦或是活动策划、旅游攻略等内容,它都能提供支持,帮助用户精准表达,轻松呈现各种信息。

AI办公办公工具AI工具讯飞智文AI在线生成PPTAI撰写助手多语种文档生成AI自动配图热门
讯飞星火

讯飞星火

深度推理能力全新升级,全面对标OpenAI o1

科大讯飞的星火大模型,支持语言理解、知识问答和文本创作等多功能,适用于多种文件和业务场景,提升办公和日常生活的效率。讯飞星火是一个提供丰富智能服务的平台,涵盖科技资讯、图像创作、写作辅助、编程解答、科研文献解读等功能,能为不同需求的用户提供便捷高效的帮助,助力用户轻松获取信息、解决问题,满足多样化使用场景。

热门AI开发模型训练AI工具讯飞星火大模型智能问答内容创作多语种支持智慧生活
Spark-TTS

Spark-TTS

一种基于大语言模型的高效单流解耦语音令牌文本到语音合成模型

Spark-TTS 是一个基于 PyTorch 的开源文本到语音合成项目,由多个知名机构联合参与。该项目提供了高效的 LLM(大语言模型)驱动的语音合成方案,支持语音克隆和语音创建功能,可通过命令行界面(CLI)和 Web UI 两种方式使用。用户可以根据需求调整语音的性别、音高、速度等参数,生成高质量的语音。该项目适用于多种场景,如有声读物制作、智能语音助手开发等。

Trae

Trae

字节跳动发布的AI编程神器IDE

Trae是一种自适应的集成开发环境(IDE),通过自动化和多元协作改变开发流程。利用Trae,团队能够更快速、精确地编写和部署代码,从而提高编程效率和项目交付速度。Trae具备上下文感知和代码自动完成功能,是提升开发效率的理想工具。

AI工具TraeAI IDE协作生产力转型热门
咔片PPT

咔片PPT

AI助力,做PPT更简单!

咔片是一款轻量化在线演示设计工具,借助 AI 技术,实现从内容生成到智能设计的一站式 PPT 制作服务。支持多种文档格式导入生成 PPT,提供海量模板、智能美化、素材替换等功能,适用于销售、教师、学生等各类人群,能高效制作出高品质 PPT,满足不同场景演示需求。

讯飞绘文

讯飞绘文

选题、配图、成文,一站式创作,让内容运营更高效

讯飞绘文,一个AI集成平台,支持写作、选题、配图、排版和发布。高效生成适用于各类媒体的定制内容,加速品牌传播,提升内容营销效果。

热门AI辅助写作AI工具讯飞绘文内容运营AI创作个性化文章多平台分发AI助手
材料星

材料星

专业的AI公文写作平台,公文写作神器

AI 材料星,专业的 AI 公文写作辅助平台,为体制内工作人员提供高效的公文写作解决方案。拥有海量公文文库、9 大核心 AI 功能,支持 30 + 文稿类型生成,助力快速完成领导讲话、工作总结、述职报告等材料,提升办公效率,是体制打工人的得力写作神器。

openai-agents-python

openai-agents-python

OpenAI Agents SDK,助力开发者便捷使用 OpenAI 相关功能。

openai-agents-python 是 OpenAI 推出的一款强大 Python SDK,它为开发者提供了与 OpenAI 模型交互的高效工具,支持工具调用、结果处理、追踪等功能,涵盖多种应用场景,如研究助手、财务研究等,能显著提升开发效率,让开发者更轻松地利用 OpenAI 的技术优势。

Hunyuan3D-2

Hunyuan3D-2

高分辨率纹理 3D 资产生成

Hunyuan3D-2 是腾讯开发的用于 3D 资产生成的强大工具,支持从文本描述、单张图片或多视角图片生成 3D 模型,具备快速形状生成能力,可生成带纹理的高质量 3D 模型,适用于多个领域,为 3D 创作提供了高效解决方案。

下拉加载更多