Files
camera-gallery/README.md
2025-10-21 20:30:20 +01:00

152 lines
3.8 KiB
Markdown

# 📸 Embedded Gallery SPA
![Badge Label](https://img.shields.io/badge/dev,branch-working-color.svg)
![Build Status](https://img.shields.io/badge/compile-pass-brightgreen.svg)
![License](https://img.shields.io/badge/License:-copyright,©2025-darkred)
---
A lightweight, responsive single-page photo gallery built for embedded Linux systems (e.g., OpenWrt).
This project provides a modern web interface for browsing, uploading, and managing photos directly on your embedded device — optimized for low-resource environments with PHP-FPM and Nginx.
---
## 🚀 Features
- **Single Page Application (SPA)** navigation — no full page reloads
- **Dynamic gallery** with infinite scroll and lazy loading
- **GLightbox integration** for fullscreen previews and image metadata
- **EXIF caching system** — stores camera data, lens, aperture, ISO, shutter speed, etc.
- **Drag & drop uploads** with progress bars and live updates
- **Dark / Light themes** with persistent preference
- **System stats dashboard** (CPU, memory, disk, uptime, swap)
- **Web shell interface** (optional, secure)
- **Admin mode** with session-based authentication
- **Optimized for low RAM and embedded devices**
---
## 🧱 Directory Structure
```
/var/www/
├── index.php
├── includes/
│ ├── config.php
│ ├── api.php
│ └── admin_auth.php
├── pages/
│ ├── home.php
│ ├── gallery.php
│ ├── upload.php
│ ├── stats.php
│ ├── shell.php
│ └── admin.php
├── css/
│ ├── style.css
│ ├── home.css
│ ├── upload.css
│ ├── dashboard.css
├── js/
│ ├── app.js
│ ├── home.js
│ ├── gallery.js
│ ├── upload.js
│ ├── stats.js
│ ├── shell.js
│ ├── admin.js
├── cache/
├── thumbs/
└── uploads/
```
---
## ⚙️ Requirements
- **OpenWrt / Linux**
- **PHP 8.4+** with:
- `php-fpm`
- `php-session`
- `php-exif`
- `php-gd`
- `php-json`
- **Nginx** (configured to serve `/srv/www/`)
- **ImageMagick** *(optional)* for RAW → JPEG conversion
- **Filesystem access** to `/srv/www/a77ii/sorted/jpg` and `/srv/www/thumbs/`
---
## 🔧 Installation
1. **Copy or extract the ZIP:**
```bash
sudo unzip srv_www_final.zip -d /srv/
```
2. **Set permissions:**
```bash
sudo chown -R www-data:www-data /srv/www
sudo chmod -R 755 /srv/www
```
3. **Check PHP-FPM session support:**
```bash
php -m | grep session
```
4. **Open your browser:**
```
https://<device-ip>/
```
---
## 🔐 Admin Login
To enable upload and admin features:
1. **Generate a password hash:**
```php
php -r "echo password_hash('YourPassword', PASSWORD_BCRYPT);"
```
2. **Paste the result into includes/config.php:**
```json
[
'upload_password' => '$2y$10$replaceThisWithYourOwnHash',
]
```
---
## ⚡ Performance Tips
1. **Enable Gzip and Brotli in Nginx for faster page loads:**
```
gzip on;
gzip_types text/plain text/css application/javascript application/json;
brotli on;
brotli_types text/plain text/css application/javascript application/json;
```
2. **Tune PHP-FPM memory usage for small devices (256MB RAM, 4GB swap):**
```
pm = dynamic
pm.max_children = 5
pm.start_servers = 2
pm.min_spare_servers = 1
pm.max_spare_servers = 3
memory_limit = 64M
```
---
## 📦 Updating
1. **Use the included helper script:**
```bash
sh update-www.sh srv_www_final.zip
```
**It will back up the old site, extract the new one, and fix permissions automatically.**
---
## 🧑‍💻 Author
### James Blackmore (reclusejay)
#### Built with ❤️ and PHP for embedded systems.
---
## 📜 License
**This project is license is Pending (all rights reserved until specified).**
---