feat: implement web interface for image management (#397)

Commit: 5c2edfd14768b8815edabe50738d4ccf420eafbd
Date: 2025-10-13 21:26:18 +0000
Author: PascalHavelange

Commit Message

feat: implement web interface for image management (#397)

* feat: implement web interface for image management

Add complete web UI for the image processing workflow with separate upload and view functionality.

## Image Processing Flow
1. **ImageUpload** - Users upload images via web form (creates ImageUpload record)
2. **Background Processing** - ImageUploadListener automatically processes uploads, resizes images, and moves them to available images storage
3. **AvailableImage** - Processed images appear automatically for viewing (READ-ONLY)

## Changes

### Controllers
- **ImageUploadController** - Handles image upload form and file submission
  - `create()` - Display upload form
  - `store()` - Process upload, dispatch ImageUploadEvent
- **AvailableImageController** - Manages viewing of processed images (READ-ONLY)
  - `index()` - List all available images with search
  - `show()` - Display single image details
  - `view()` - Serve image file for display
  - `download()` - Download image file

### Views
- **images/upload.blade.php** - Image upload form with file input and processing information
- **available-images/index.blade.php** - Grid view of processed images with search functionality
- **available-images/show.blade.php** - Detailed view of single image with download option

### Navigation
- Added "Images" dropdown menu in navigation with:
  - "Available Images" (VIEW_DATA permission required)
  - "Upload Images" (CREATE_DATA permission required)
- Added "Image Management" section on home page with tiles for both functions

### Routes
- `GET /web/images/upload` - Upload form (CREATE_DATA permission)
- `POST /web/images/upload` - Process upload (CREATE_DATA permission)
- `GET /web/available-images` - List images (VIEW_DATA permission)
- `GET /web/available-images/{id}` - Show image (VIEW_DATA permission)
- `GET /web/available-images/{id}/view` - View image file (VIEW_DATA permission)
- `GET /web/available-images/{id}/download` - Download image (VIEW_DATA permission)

### Form Request
- **StoreImageUploadRequest** - Validates uploaded images
  - File required, must be image type
  - Validates MIME types (jpeg, png, jpg)
  - Validates file size (max from config)

### Tests
All 24 tests passing:
- **AvailableImage Tests** (13 tests)
  - IndexTest - List, search, empty state, pagination
  - ShowTest - Display details, download button, back link
  - PermissionsTest - Guest/authenticated/permission checks
- **ImageUpload Tests** (11 tests)
  - CreateTest - Form rendering, file input, information display
  - StoreTest - Upload success, validation, metadata persistence, event dispatch
  - PermissionsTest - Guest/authenticated/permission checks

## Architecture Notes
- AvailableImages are READ-ONLY in the web interface (no create/edit/delete)
- Upload functionality is separate and requires CREATE_DATA permission
- Images are automatically processed by background listener after upload
- ImageUpload records are deleted after successful processing
- Maintains consistency with existing web CRUD patterns

## Testing
```powershell
# Run all image management web tests
php artisan test --filter="Web\\(ImageUpload|AvailableImage)"

All tests pass with proper permission checks and workflow validation.


Co-authored-by: Pascal HAVELANGE havelangep@hotmail.com ```

Files Changed


This documentation was automatically generated from Git commit data.