# Photo Garden

Single-page, PWA-style photo gallery intended for static hosting.

## What it does

- Shows one growing gallery page with responsive square thumbnails.
- Lets you drag and drop items into a new saved order.
- Lets you switch between custom order and newest-first view.
- Opens each image in a browser-sized fullscreen viewer.
- Lets viewers open the original full-size file from the viewer.
- Lets you delete images from the gallery.
- Lets you save web links as cards in the same gallery.
- Lets you add optional notes/captions to items.
- Accepts images, PDFs, docs, ZIPs, Apple Pages/Numbers files, and audio files, with non-image items shown as file cards.
- Supports install-to-home-screen behavior through a manifest and service worker.
- Uses simple PHP endpoints for uploads, listing, and deletes on traditional hosting like GoDaddy.
- Falls back to demo mode when the PHP files are not available yet.

## Files

- `index.html` - app shell and config block
- `styles.css` - layout and responsive gallery styling
- `app.js` - gallery rendering, PHP upload/delete logic, viewer, and PWA behavior
- `sw.js` - service worker for shell caching
- `manifest.webmanifest` - install metadata
- `photo-store.php` - shared PHP helpers and storage paths
- `photos.php` - gallery JSON feed
- `upload.php` - image upload endpoint
- `delete.php` - image delete endpoint
- `reorder.php` - saves thumbnail order after drag and drop
- `add-link.php` - saves a URL as a gallery card
- `update-item.php` - saves captions or notes

## GoDaddy/PHP setup

1. Upload this whole `photo_gallery_pwa` folder to your GoDaddy hosting.
2. Make sure your hosting plan supports PHP.
3. Make sure these paths are writable by PHP on the server:
   - `projects/photo_gallery_pwa/uploads/`
   - `projects/photo_gallery_pwa/data/photos.json`
4. If you want to require a delete token later, edit `photo-store.php` and set `PHOTO_GARDEN_DELETE_TOKEN`.
5. In `index.html`, the config block now looks like:

```js
window.GALLERY_CONFIG = {
  galleryTitle: "Photo Garden",
  apiBase: "./",
  deleteToken: ""
};
```

## Important note

For a simple hosted setup, the PHP files are now the storage layer. The images are saved into the local `uploads` folder on your site, and metadata is saved in `data/photos.json`.
