pigallery2
A fast directory-first photo gallery website, with rich UI, optimized for running on low resource servers (especially on raspberry pi)
Top Related Projects
AI-Powered Photos App for the Decentralized Web 🌈💎✨
👉 Go to chevereto/chevereto for newer Chevereto releases. Self-hosted image sharing software, your own Flickr/Imgur with your very own rules.
A great looking and easy-to-use photo-management-system you can run on your server, to manage and share photos.
A great looking and easy-to-use photo-management-system you can run on your server, to manage and share photos.
Self hosted alternative to Google Photos
Quick Overview
PiGallery2 is a self-hosted, responsive web photo gallery application. It's designed to organize and display photos and videos, with a focus on fast navigation and easy setup. PiGallery2 runs on various platforms, including low-power devices like Raspberry Pi.
Pros
- Easy to set up and use, with a user-friendly interface
- Supports various media formats, including photos and videos
- Offers face recognition and GPS location features
- Responsive design, works well on both desktop and mobile devices
Cons
- Requires self-hosting, which may be challenging for non-technical users
- Limited customization options compared to some other gallery solutions
- May have performance issues with very large photo collections
- Depends on external tools for some features (e.g., ExifTool for metadata extraction)
Getting Started
To set up PiGallery2:
- Install Node.js (version 16 or later)
- Clone the repository:
git clone https://github.com/bpatrik/pigallery2.git cd pigallery2
- Install dependencies:
npm install
- Build the application:
npm run build
- Start PiGallery2:
npm start
- Access the gallery at
http://localhost:80
For more detailed instructions and configuration options, refer to the project's README and documentation.
Competitor Comparisons
AI-Powered Photos App for the Decentralized Web 🌈💎✨
Pros of PhotoPrism
- More advanced AI-powered features, including facial recognition and object detection
- Supports a wider range of file formats, including RAW images and videos
- Offers a more polished and modern user interface
Cons of PhotoPrism
- Higher system requirements and resource usage
- Steeper learning curve due to more complex features
- Lacks some customization options available in PiGallery2
Code Comparison
PhotoPrism (Go):
func (m *Search) Photos(f form.SearchPhotos) (results PhotoResults, err error) {
s := UnscopedDb().Table("photos").Select("photos.*").
Where("photos.deleted_at IS NULL").
Where("photos.photo_quality >= 3")
// ... (additional code)
}
PiGallery2 (TypeScript):
export class SearchManager {
public static search(text: string): Promise<SearchResult> {
return SQLConnection.selectFromDB(
'SELECT * FROM media WHERE name LIKE ? OR directory LIKE ?',
['%' + text + '%', '%' + text + '%']
);
}
}
The code snippets show different approaches to implementing search functionality. PhotoPrism uses a more complex query builder in Go, while PiGallery2 employs a simpler SQL query in TypeScript. This reflects the overall difference in complexity and feature set between the two projects.
👉 Go to chevereto/chevereto for newer Chevereto releases. Self-hosted image sharing software, your own Flickr/Imgur with your very own rules.
Pros of Chevereto-free
- More user-friendly interface for non-technical users
- Built-in social features like user profiles and image sharing
- Supports multiple storage providers out of the box
Cons of Chevereto-free
- Less flexible for customization compared to PiGallery2
- Requires PHP and MySQL, which may be less performant for large galleries
- Limited metadata support and advanced search capabilities
Code Comparison
PiGallery2 (TypeScript):
@Get('gallery/:galleryPath(*)')
public async getGallery(@Param('galleryPath') galleryPath: string): Promise<GalleryDTO> {
return this.galleryService.getGallery(galleryPath);
}
Chevereto-free (PHP):
public function get_album($id) {
$album = Album::getSingle($id);
if (!$album) {
return $this->throw_error(404);
}
return $album;
}
PiGallery2 uses TypeScript and a more modern, modular approach, while Chevereto-free relies on PHP with a more traditional object-oriented structure. PiGallery2's code appears more concise and type-safe, potentially offering better maintainability for developers familiar with TypeScript and modern web frameworks.
A great looking and easy-to-use photo-management-system you can run on your server, to manage and share photos.
Pros of Lychee
- More polished and user-friendly interface
- Better support for video files
- More active development and larger community
Cons of Lychee
- Less flexible folder structure management
- Fewer advanced search and filtering options
- Limited support for RAW image formats
Code Comparison
Lychee (PHP):
public function add(Request $request)
{
$request->validate([
'albumID' => 'required|string',
'function' => 'required|string',
]);
PiGallery2 (TypeScript):
public async addPhoto(file: Express.Multer.File, metadata: PhotoMetadata): Promise<Photo> {
const photo = new Photo();
photo.name = file.originalname;
photo.metadata = metadata;
Both projects use different programming languages, with Lychee primarily using PHP and PiGallery2 using TypeScript. Lychee's code structure tends to be more straightforward, while PiGallery2 offers more type safety and object-oriented patterns.
Lychee focuses on simplicity and ease of use, making it a good choice for users who want a quick setup and intuitive interface. PiGallery2, on the other hand, provides more advanced features and customization options, catering to users who need granular control over their photo management system.
A great looking and easy-to-use photo-management-system you can run on your server, to manage and share photos.
Pros of Lychee
- More polished and user-friendly interface
- Better support for album organization and management
- Integrated image editing features
Cons of Lychee
- Less flexible in terms of customization options
- Fewer advanced features for power users
- More resource-intensive, especially for large collections
Code Comparison
Lychee (PHP):
public function add(Request $request)
{
$request->validate([
'albumID' => 'nullable|string',
'function' => 'required|string',
]);
// ... (implementation)
}
PiGallery2 (TypeScript):
@Post('/upload')
@UseInterceptors(FileInterceptor('file'))
async uploadFile(@UploadedFile() file: Express.Multer.File, @Body() body: any) {
// ... (implementation)
}
Both projects use different languages and frameworks, making direct code comparison challenging. Lychee uses PHP with Laravel, while PiGallery2 is built with TypeScript and NestJS. Lychee's code tends to be more concise due to Laravel's conventions, while PiGallery2's TypeScript code offers stronger typing and more explicit structure.
Self hosted alternative to Google Photos
Pros of Ownphotos
- Built with Django and React, offering a modern web framework and UI library
- Includes face recognition and object detection features
- Supports automatic album creation based on events and places
Cons of Ownphotos
- Less active development compared to PiGallery2
- Fewer stars and forks on GitHub, indicating a smaller community
- Limited documentation and setup instructions
Code Comparison
PiGallery2 (TypeScript):
export class PhotoDTO {
public id: number;
public name: string;
public metadata: PhotoMetadata;
}
Ownphotos (Python):
class Photo(models.Model):
image_hash = models.CharField(primary_key=True, max_length=32, null=False)
thumbnail = models.ImageField(upload_to='thumbnails')
image = models.ImageField(upload_to='photos')
Both projects use strongly-typed languages, with PiGallery2 utilizing TypeScript for frontend development and Ownphotos using Python with Django for backend implementation. PiGallery2 focuses on a more traditional photo gallery structure, while Ownphotos includes additional features like face recognition and event-based organization.
PiGallery2 has a larger community and more frequent updates, potentially offering better long-term support and feature additions. However, Ownphotos provides unique AI-powered features that may appeal to users looking for advanced photo organization capabilities.
Convert designs to code with AI
Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.
Try Visual CopilotREADME
PiGallery2
Homepage: http://bpatrik.github.io/pigallery2/
This is a fast (like faster than your PC fast) directory-first photo gallery website, optimised for running on low resource servers (especially on raspberry pi).
âï¸ Strengths:
- â¡ Fast, like for real.
- âï¸ Simple. Point to your photos folder and to a temp folder and you are good to go.
â Weakness:
- ð¥ Its simple. Shows what you have that's it. No gallery changes (photo delete, rotate, enhance, tag, organize, etc), your gallery folder is read-only.
- ð Optimized for galleries with <100K photos with <5k photos/folder.
- It will work on bigger galleries, but it will start to slow down.
Live Demo
Live Demo @ render: https://pigallery2.onrender.com/
- the demo page first load might take up 30s: the time while the free webservice boots up
Table of contents
- Getting started
- Translate the page to your own language
- Feature list
- Suggest/endorse new features
- Known errors
- Credits
1. Getting started (also works on Raspberry Pi)
1.1 Install and Run with Docker (recommended)
Docker with docker-compose is the official and recommend way of installing and running Pigallery2. It contains all necessary dependencies, auto restarts on reboot, supports https, easy to upgrade to newer versions. For configuration and docker-compose files read more here or check all builds here.
1.2 Direct Install (if you are familiar with Node.js and building npm packages from source)
As an alternative, you can also directly install Node.js and the app and run it natively.
1.2.0 Install Node.js
Download and extract
curl -sL https://deb.nodesource.com/setup_12.x | sudo -E bash -
sudo apt-get install -y nodejs
Full node install on raspberry pi description: https://www.w3schools.com/nodejs/nodejs_raspberrypi.asp
1.2.1 Install PiGallery2
1.2.1-a Install from release
cd ~
wget https://github.com/bpatrik/pigallery2/releases/download/1.9.0/pigallery2-release.zip
unzip pigallery2-release.zip -d pigallery2
cd pigallery2
npm install
1.2.1-b Install from source
Note: A build requires a machine with around 2GB or memory.
cd ~
wget https://github.com/bpatrik/pigallery2/archive/master.zip
unzip master.zip
cd pigallery2-master # enter the unzipped directory
npm install
npm run build
Note: It is recommended to create a release version with npm run create-release
on a more powerful machine and deploy that to you server.
Note: you can use npm run create-release -- --languages=fr,ro
to restrict building to the listed languages (English is added by default)
1.2.2 Run PiGallery2
npm start
To configure it, run PiGallery2
first to create config.json
file, then edit it and restart.
The app has a nice UI for settings, you may use that too.
Default user: admin
pass: admin
. (It is not possible to change the admin password, you need to create another user and delete the default admin
user, see #220)
Note: First run, you might have file access issues and port 80 issue, see #115.
Running npm start -- --Server-port=8080
will start the app on port 8080 that does not require root
Adding read/write permissions to all files can solve the file access issue chmod -R o-w .
, see #98.
1.2.2.1 Run on startup
You can run the app up as a service to run it on startup. Read more at #42
1.3 Advanced configuration
You can set up the app any of the following ways:
- Using the UI (recommended)
- Manually editing the
config.json
- Through switches
- Like:
node start -- --Server-port=3000 --Client-authenticationRequired=false
- You can check the generated
config.json
for the config hierarchy
- Like:
- Through environmental variable
- like set env. variable
Server-port
to3000
- like set env. variable
Full list of configuration options are available at the MANPAGE.md.
1.4 Useful links/tips:
using nginx
It is recommended to use a reverse proxy like nginx before node https://stackoverflow.com/questions/5009324/node-js-nginx-what-now
making https
With cerbot & nginx it is simple to set up secure connection. You have no excuse not doing so. https://certbot.eff.org/
node install error:
If you get error during module installation, make sure you have everything to build node modules from source
apt-get install build-essential libkrb5-dev gcc g++
2. Translate the page to your own language
- Install Pigallery2 from source (with the release it won't work)
- add your language e.g: fr
- copy
src/frontend/translate/messages.en.xlf
tosrc/frontend/translate/messages.fr.xlf
- add the new translation to the
angular.json
projects->pigallery2->i18n->locales
section
- copy
- translate the file by updating the
<target>
tags - test if it works:
build and start the app
npm install npm run build npm start
- (optional) create a pull request at github to add your translation to the project.
Note: you can also build your own release with as described in 1.1.1-b Install from source;
3. Feature list
See: http://bpatrik.github.io/pigallery2/
4. Suggest/endorse new features
Unfortunately, I only have a limited time for this hobby project of mine. And I mostly focus on those features that are align with my needs. Sorry :(. Although, I try to fix bugs ASAP (that can still take from a few days to months). The recommended way of extending the projects is to implement the feature as an extension. See #743. If the extension framweork is not powerfull enough, so you can't implement your feature, you are welcome to open a FR bug and I will consider adding that. If you really want to contribute and think that your feature has a place in the mainapp, look at CONTRIBUTING.md for some guidance.
5. Known errors
- IOS map issue
- Map on IOS prevents using the buttons in the image preview navigation, see #155
- Video support on weak servers (like raspberry pi) with low upload rate
- video playback may use up too much resources and the server might not respond for a while. Enable video transcoding in the app, to transcode the videos to lover bitrate.
- When using an Apache proxy, sub folders are not accessible
- add
AllowEncodedSlashes On
in the configuration of the proxy
- add
6. Supporting the project
I'm making this app for my own entertainment, but I like to share it with others as the contributions and bug reports make the app better and it also does not cost anything to me :)
There is no way to donate to this project at the moment. And I'm also not planning on monetizing it. But it warms my hearth seeing that it is useful for some people.
6. Credits
Crossbrowser testing sponsored by Browser Stack
Top Related Projects
AI-Powered Photos App for the Decentralized Web 🌈💎✨
👉 Go to chevereto/chevereto for newer Chevereto releases. Self-hosted image sharing software, your own Flickr/Imgur with your very own rules.
A great looking and easy-to-use photo-management-system you can run on your server, to manage and share photos.
A great looking and easy-to-use photo-management-system you can run on your server, to manage and share photos.
Self hosted alternative to Google Photos
Convert designs to code with AI
Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.
Try Visual Copilot