Compare commits

..

No commits in common. "69d08b0c7acd49a3cf3b80f36511fa86a9afde2a" and "fd89caac7bdab4e74bafc88cfd1b6d15d910a6b8" have entirely different histories.

8 changed files with 11 additions and 35 deletions

View File

@ -1,4 +1,4 @@
FROM node:22.2.0-alpine AS client-builder FROM node:22.2.0-alpine as client-builder
COPY picture-gallery-client/package*.json /usr/src/app/picture-gallery-client/ COPY picture-gallery-client/package*.json /usr/src/app/picture-gallery-client/
WORKDIR /usr/src/app/picture-gallery-client WORKDIR /usr/src/app/picture-gallery-client
@ -14,7 +14,7 @@ RUN mkdir built && \
cp .env built && \ cp .env built && \
npm ci --prefix ./built --only=production npm ci --prefix ./built --only=production
FROM node:22.2.0-alpine AS server-builder FROM node:22.2.0-alpine as server-builder
COPY picture-gallery-server/package*.json /usr/src/app/picture-gallery-server/ COPY picture-gallery-server/package*.json /usr/src/app/picture-gallery-server/
WORKDIR /usr/src/app/picture-gallery-server WORKDIR /usr/src/app/picture-gallery-server

View File

@ -8,33 +8,21 @@ Simple Picture Gallery is a modern looking web app due to [Material UI](https://
## Screenshots ## Screenshots
### Desktop
![Simple Picture Gallery](doc/images/main.png) ![Simple Picture Gallery](doc/images/main.png)
![Simple Picture Gallery lightbox](doc/images/lightbox.png)
### Mobile
![Simple Picture Gallery mobile](doc/images/mainMobile.png)
![Simple Picture Gallery mobile with drawer](doc/images/mobileWithDrawer.png)
![Simple Picture Gallery mobile lightbox](doc/images/mobileLightbox.png)
## Getting Started ## Getting Started
### Information ### Information
Folders should only contain images and other folders. Folders should not contain any other files. Folders should only contain images and folders. Folders should not contain any other files.
### Docker ### Docker
An easy way to run simple picture gallery is with docker. An easy way to run simple picture gallery is with docker.
```shell ```shell
docker pull docker pull ghcr.io/t-h-e/simple-picture-gallery:latest docker pull gitea.forstenlechner.dev/stefan/simple-picture-gallery:latest
docker run -p 3005:3001 -v /mnt/path/to/pictures:/usr/src/app/public --name my-picture-gallery ghcr.io/t-h-e/simple-picture-gallery:latest docker run -p 3005:3001 -v /mnt/path/to/pictures:/usr/src/app/public --name my-picture-gallery gitea.forstenlechner.dev/stefan/simple-picture-gallery:latest
``` ```
#### Customization #### Customization
@ -50,17 +38,17 @@ VITE_FAVICON_HREF=<URL to your favicon>
And run docker with `--env-file .env` And run docker with `--env-file .env`
```shell ```shell
docker run -p 3005:3001 -v /mnt/path/to/pictures:/usr/src/app/public --env-file .env --name my-picture-gallery ghcr.io/t-h-e/simple-picture-gallery:latest docker run -p 3005:3001 -v /mnt/path/to/pictures:/usr/src/app/public --env-file .env --name my-picture-gallery gitea.forstenlechner.dev/stefan/simple-picture-gallery:latest
``` ```
### Docker Compose ### Docker compose
Even easier to run it using docker compose. Even easier to run it using docker compose.
```dockerfile ```dockerfile
services: services:
gallery: gallery:
image: ghcr.io/t-h-e/simple-picture-gallery:latest image: gitea.forstenlechner.dev/stefan/simple-picture-gallery:latest
container_name: my-picture-gallery container_name: my-picture-gallery
environment: environment:
# customize your gallery # customize your gallery
@ -73,18 +61,10 @@ services:
- "3005:3001" - "3005:3001"
``` ```
### Hint ### nginx
On first startup, the application is going to create thumbnails of all images. This can lead to heavy CPU usage. Thumbnails for images that are added after starting the application are created on the fly.
Thumbnails are stored in a folder `.thumbnail` in the mounted folder. In case you want to remove simple picture gallery at some point. Simply remove the container and delete the `.thumbnail` folder.
### Configure a cache with nginx
It is recommended to use a cache for the API calls so that not every request has to read from your file system again. It is recommended to use a cache for the API calls so that not every request has to read from your file system again.
When using a cache, new images may not be available straight away as previous requests are then obviously cached. Set the cache timeout accordingly.
In case you are using nginx as reverse proxy already, here is an example config with a cache. In case you are using nginx as reverse proxy already, here is an example config with a cache.
```nginx ```nginx
@ -102,7 +82,6 @@ http {
location ~ /(images|directories|folderspreview) { location ~ /(images|directories|folderspreview) {
proxy_cache picture_gallery_cache; proxy_cache picture_gallery_cache;
# cache is valid for 60 minutes. Reduce or increase this time according to your needs.
proxy_cache_valid 200 302 60m; proxy_cache_valid 200 302 60m;
proxy_cache_min_uses 1; proxy_cache_min_uses 1;
proxy_pass http://127.0.0.1:3005; proxy_pass http://127.0.0.1:3005;
@ -118,7 +97,4 @@ http {
> **_NOTE:_** `proxy_cache_path` and `proxy_cache` need to use the same zone. > **_NOTE:_** `proxy_cache_path` and `proxy_cache` need to use the same zone.
See [nginx documentation](https://nginx.org/en/docs/http/ngx_http_proxy_module.html) for more details and parameters. See [nginx documentation](https://nginx.org/en/docs/http/ngx_http_proxy_module.html) for more details and parameters.
---
Photos from [Unsplash](https://unsplash.com)

Binary file not shown.

Before

Width:  |  Height:  |  Size: 329 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 192 KiB

After

Width:  |  Height:  |  Size: 222 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 143 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 288 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 101 KiB

View File

@ -72,7 +72,7 @@ export const ImageGalleryMain = ({
</> </>
)} )}
{images.length > 0 && foldersPreview.length > 0 && ( {images.length > 0 && foldersPreview.length > 0 && (
<Divider style={{ marginBottom: "10px", marginTop: "10px" }}> <Divider style={{ marginBottom: "10px" }}>
<Chip label="Images" size="small" /> <Chip label="Images" size="small" />
</Divider> </Divider>
)} )}