# ARCHIVE — A No-Database Photo Gallery

A PHP photo gallery that treats your filesystem as the database. Drop folders of photos into `/photos`, refresh, done.

Editorial / curatorial design system: Fraunces variable serif, JetBrains Mono for metadata, warm cream on near-black, film grain overlay, asymmetric grid, custom cursor, and a cinematic lightbox that reads EXIF from your JPEGs.

## Requirements

- PHP 8.0+
- `gd` extension (for thumbnails) — usually installed
- `exif` extension (for camera metadata) — usually installed
- A web server (Apache, Nginx, or `php -S` for testing)

## Quick start

```bash
php -S 127.0.0.1:8000
```

Then open http://127.0.0.1:8000.

For production: drop the whole folder onto any PHP host. No build step. No composer install.

## Adding your photos

Each folder under `/photos` becomes an album. Inside, drop JPGs (or PNG, GIF, WebP).

```
photos/
  01_istanbul_quietude/
    album.json          ← optional metadata
    frame_001.jpg
    frame_002.jpg
    ...
  02_kirkland_blue_hour/
    ...
```

**Folder naming**: prefix with `01_`, `02_` etc. to control ordering. The prefix is stripped from the display title. Underscores and hyphens become spaces.

**Photo ordering**: alphabetical by filename. Same trick — name them `frame_001.jpg`, `frame_002.jpg` or `001_morning.jpg` to control order.

## Album metadata (`album.json`)

Optional. Drop next to your photos to override the auto-generated title and add context.

```json
{
  "title": "Istanbul, Quietude",
  "location": "Beyoğlu — Istanbul, Turkey",
  "date": "April 2026",
  "description": "Notes from a slow week in the upper city."
}
```

## EXIF

If your JPEGs have EXIF (most cameras and phones write it by default), the lightbox panel will show camera, lens, ISO, shutter, aperture, focal length, and capture date. The demo placeholder photos here have no EXIF, so those fields show `—`. Drop in a real shot from your Lumix G85 and you'll see it light up.

## Thumbnails

Generated on first request by `thumb.php`, cached forever in `/thumbs/`. Three sizes:
- `sm` — 480px (album cover previews)
- `md` — 1000px (grid tiles)
- `lg` — 2000px (lightbox)

Edit `config.php` to change sizes or JPEG quality. Delete `/thumbs/` to regenerate.

## Customization

- **Site title / subtitle**: `config.php`
- **Hero text**: the five-word title in `index.php` (`The / Archive / of / Quiet / Light`). Edit it directly.
- **Colors and typography**: top of `assets/css/style.css`. The whole palette lives in CSS variables. Try a different accent (`--accent`) — sage green, gold, or electric blue all work.
- **Manifesto**: bottom of the index in `index.php`. Three lines of poetry. Make them yours.

## File structure

```
.
├── index.php           — router + views
├── thumb.php           — thumbnail endpoint
├── config.php          — settings
├── lib/
│   └── Gallery.php     — directory scanner, EXIF reader
├── assets/
│   ├── css/style.css
│   └── js/app.js       — cursor, hover preview, lightbox
├── photos/             — your albums go here
└── thumbs/             — generated cache (safe to delete)
```

## Production notes

- Make `/thumbs/` writable by the web server (usually `chmod 755` is enough).
- The thumbnail endpoint validates inputs but, if you're paranoid, put `/photos/` outside the web root and serve only through `thumb.php` + a similar `serve.php`.
- For pretty URLs (`/album/istanbul-quietude` instead of `?album=...`), add an `.htaccess` with a rewrite rule. The current code uses query strings to work without it.

## Why no database

Files are the source of truth. Backup is `rsync`. Drag-and-drop publishing. Trivial to migrate. Trivial to port to a static generator later. The whole "schema" is your folder names. The whole "admin UI" is Finder.

It scales fine to a few thousand photos. Past that, cache the directory scan to a JSON file and rebuild on a cron or on demand.

---

No database. No tracking. Only light.
