From 8f319f4039890de257919e655da67a3aeddf4c466449dc89767fd6c9767fa235 Mon Sep 17 00:00:00 2001 From: reclusejay Date: Tue, 21 Oct 2025 17:51:36 +0100 Subject: [PATCH] Initial Upload --- .gitignore | 8 +++ README.md | 140 +++++++++++++++++++++++++++++++++++++++++++++++++++-- 2 files changed, 145 insertions(+), 3 deletions(-) create mode 100644 .gitignore diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..4c53276 --- /dev/null +++ b/.gitignore @@ -0,0 +1,8 @@ +logs/ +src/cache/** +src/img/** +*.code-workspace +**.log +src/pages/infophp.php +src/pages/gethash.php + diff --git a/README.md b/README.md index 5845d3e..09090e4 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,138 @@ -# camera-gallery +# 📸 Embedded Gallery SPA -Embedded Gallery SPA -A lightweight, responsive single-page photo gallery built for embedded Linux systems (e.g., OpenWrt). \ No newline at end of file +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 + +/srv/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/ +└── logs/ + + +--- + +## ⚙️ Requirements + +- **OpenWrt / Linux** +- **PHP 8+** 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/ + + Set permissions: + +sudo chown -R www-data:www-data /srv/www +sudo chmod -R 755 /srv/www + +Check PHP-FPM session support: + +php -m | grep session + +Open your browser: + + https:/// + +🔐 Admin Login + +To enable upload and admin features: + + Generate a password hash: + +php -r "echo password_hash('YourPassword', PASSWORD_BCRYPT);" + +Paste the result into includes/config.php: + + 'upload_password' => '$2y$10$replaceThisWithYourOwnHash', + +⚡ Performance Tips + + 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; + +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 + +Use the included helper script: + +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 released under the MIT License. +Feel free to modify, extend, and use it in your own projects.