How agentsquidflaps/picture works
Core Components
• Picture Generator (Central Component)
• Source Adapters Layer
• Media Query Handler
• Image Processing Pipeline
Adapter Integration Layer
Following adapters with clear separation:
• Cloudfront Adapter
• Intervention Adapter
• PicSum Adapter
• PlaceImg Adapter
• NullImg Adapter
Feature Processing Modules
• WebP Conversion
• Retina Processing
• Lazy Loading
• MIME Type Handler
Component Relationships
• Picture → Source (composition)
• Source → Adapters (implementation)
• Picture → MediaQuery (association)
• Adapters → ImageMimeType (dependency)
Process Flow
Image processing pipeline:
1. Input (original image) →
2. Adapter Processing →
3. Feature Application (WebP/Retina/Lazy) →
4. HTML Output Generation
Configuration Layer
Environment configuration:
• PICTURE_WEB_ROOT
• PICTURE_CACHE_RELATIVE_PATH
• [Picture] ← Central class
• [Source] ← Source handling
• [MediaQuery] ← Media query processing
• [ImageMimeType] ← MIME type handling
Adapter Interface (Hexagon)
• <AdapterInterface>
Implementation Classes (Rounded Rectangles)
• (Cloudfront)
• (Intervention)
• (PicSum)
• (PlaceImg)
• (NullImg)
• [ChecksForSetValuesTrait]
• [RequiresAttributeMarkupTrait]
• [isLocalTrait]
• [isSourceTrait]
Clear separation between
• Local image processing (Intervention)
• Remote image services (Cloudfront, PicSum, PlaceImg)
Extensibility points
• Adapter interface
• Trait implementations
• Configuration options
External dependencies
• GD Library
• Symfony HTTP Foundation
• Intervention Image