Photo gallery repository for coin collections.
pictures/- Photo galleries in dated subdirectories (YYYY-MM-DD_HHhMM)scripts/- Python processing scriptscrop_images.py- Crop portrait photos to square formatanalyze_coins.py- AI analysis of all coinsanalyze_coins_sample.py- Test on 5 coins sample
gallery/- PHP web galleryserver.php- Built-in PHP dev server
python3 -m venv venv
source venv/bin/activate
pip install Pillow anthropic python-dotenvsource venv/bin/activate
python scripts/crop_images.py pictures/Options:
--dry-run- Preview without processing--size 1848- Target size (default: 1848x1848)--no-recursive- Process only specified directory
Crops portrait images (1848x4000) to square (1848x1848) from center, handles EXIF orientation.
php server.php
# http://127.0.0.1:8000- 2 photos per coin (pile/face) in chronological order
index.php- Redirects to gallerygallery/config.php- Centralized paths configurationgallery/index.php- Grid of all coins with filtersgallery/coin.php?id=N- Coin detail page (2 photos + legend)gallery/lightbox.php?coin=N&photo=0|1- Fullscreen lightboxgallery/edit_metadata.php- API for manual editing
Homepage:
- Filterable by country, currency, year
- Live result count
- Auto-update on filter change
Coin detail page:
- 2 photos (pile/face) with labels
- Full metadata: country, currency, value, year, notes
- AI attribution notice (auto-removed on manual edit)
- "Modifier" button for manual corrections
Lightbox:
- Fullscreen photo viewer
- Navigate between photos and coins seamlessly
- Coin page: ← → between coins
- Lightbox: ← → between photos (auto-switches coins), Esc to close
- Add password to
.env:EDIT_PASSWORD=your-password - Click "Modifier" button on coin detail page
- Enter password (saved in session)
- Edit metadata via prompts
- AI attribution removed on save
Security: CSRF protection, input validation, session-based auth
- Get API key: https://console.anthropic.com/
- Create
.envfile:
cp .env.example .env
# Edit .env and add your API keysource venv/bin/activate
python scripts/analyze_coins.py- Uses Claude Sonnet 4 (vision model)
- Extracts: country, currency, value, year, notes
- Output:
gallery/coins_metadata.json - Cost:
$0.015/coin ($1.50 for 99 coins) - Accuracy: ~95% (manual review recommended)
Test on sample (5 coins):
python scripts/analyze_coins_sample.pyTwo options:
- Edit via web interface: Click "Modifier" button on coin detail page
- Edit JSON directly: Modify
gallery/coins_metadata.json, then refresh gallery