# 📸 Embedded Gallery SPA 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.