File size: 1,848 Bytes
ef987bb | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 | # Build an offline image gallery with upload and zoom
Replace the starter `index.html` with a single front-end page that works directly in the browser without a server or network.
## Interface
- Use a multiple-file input with `data-testid="image-upload"` that accepts images the browser can decode, including PNG, SVG, JPEG, and WebP.
- Render each gallery image as an `<img>` inside `data-testid="image-list"`, or mark the images with `data-testid="uploaded-image"`.
- Keep the original images in an in-memory store. Provide `data-testid="image-store"` and `window.__getImageStore()`, which returns an independent array of the original base64 image data URLs, with the original MIME types and file bytes, in upload order. Gallery and preview images may use data URLs or object URLs as long as they display the corresponding uploaded content.
- Mark the preview with `data-testid="image-preview"`, display the selected image in an `<img>`, and place the zoom controls inside the preview, with `data-testid="zoom-button"` on at least one. Provide an upload notice region from initial load using `data-testid="status"`, `role="status"` or `role="alert"`.
## Acceptance Checklist
- Multiple selected images render and retain their original bytes and MIME types in selection order, even when files use different image formats. Later selections append without losing prior images.
- Reject non-image files without adding them to the gallery or store. Show a new visible invalid-file message rather than leaving a success message in place.
- Clicking a gallery image opens a preview containing that exact image, including when switching between different images. Zoom controls visibly enlarge and reduce the preview.
- Changing the observer's returned array cannot alter the actual stored images. The page renders and all interactions work offline.
|