Updated AGENTS and CLAUDE files.

This commit is contained in:
2026-03-23 23:53:14 -04:00
parent 3e209519e5
commit 480ec37ef6
2 changed files with 39 additions and 26 deletions

View File

@@ -49,6 +49,13 @@ The project has one Django app: **`viewer`**. All gallery functionality is conso
- `utils.py` - Thumbnail generation helpers
- `templates/` - Pure HTML templates (no JavaScript)
- `static/` - CSS styling and navigation icons
- `views.py` - Thin delegating entry points that route to `viewer/directory.py` and `viewer/image.py` (see `gallery_view` in `viewer/views.py`).
- `directory.py` - Directory browsing, search, and list rendering helpers.
- `image.py` - Single-image rendering and metadata helpers.
- `common.py` - Shared helpers: URL/query builders, sorting, breadcrumbs, thumbnail utilities.
- `utils.py` - Thumbnail generation helpers.
- `templates/` - HTML templates (minimal JS via Bootstrap where needed).
- `static/` - CSS styling and navigation icons
### Gallery Data Flow
@@ -76,21 +83,23 @@ Uses Django's built-in `django.contrib.auth` system:
**`gallery_view()` function** (viewer/views.py:65-189) handles both:
1. **Directory browsing** when path points to folder:
- Lists subdirectories and images
- Supports search with recursive directory scanning (viewer/views.py:32-52)
- Paginates images at 28 per page (7 columns × 4 rows)
- Converts flat image lists to table rows for HTML rendering
- Lists subdirectories and images
- Supports search with recursive directory scanning (`viewer/directory.py:do_recursive_search`)
- Does not use server-side pagination; the gallery returns full image lists and templates render them in a grid
- Converts image lists to structured context used by templates
2. **Image viewing** when path points to file:
- Displays single image with prev/next navigation
- Finds sibling images in same directory
- Links to full-resolution image
- Displays single image with prev/next navigation
- Finds sibling images in same directory
- Links to full-resolution image
The image view logic now lives in `viewer/image.py` and exposes additional context keys used by templates and tests (see `viewer/test.py`): `prev_url`, `next_url`, `prev_thumb`, `next_thumb`, `back_url`, `back_thumb`, `home_url`, `home_thumb`, and `image_meta` (filename/width/height/filesize/created/modified).
### Thumbnail Generation
**Lazy generation approach** (viewer/utils.py):
- Thumbnails created on-demand when viewing gallery
- 128×128 pixel size (hardcoded)
- 128×128 pixel size (`THUMB_SIZE`) and cached under `THUMBNAILS_ROOT`
- Uses Pillow for image processing
- Fast extension-based image detection (no MIME-type I/O)