Responsive Picture, LQIP & Queue
InterventionImage automates responsive <picture> markup, DPR srcset scaling, inline LQIP blur-up placeholders, and delayed .queue generation so first-time page loads stay fast.
Responsive Markup Methods (render, attrs, srcset, lqip)
Section titled “Responsive Markup Methods (render, attrs, srcset, lqip)”<?php namespace ProcessWire;
/** @var Pageimage $image */
// 1. Full <picture> + <source> (AVIF/WebP when enabled) + <img> with width/height/srcsetecho $image->render('landscape', [ 'loading' => 'eager', 'isFirst' => true, 'class' => 'yacht-hero__img',]);
// 2. Attribute array for custom template or JS framework rendering$attrs = $image->attrs(800, 600, [ 'isFirst' => true, 'decoding' => 'async',]);
// 3. Raw srcset string generated from configured `factors` (default 0.5, 1, 1.5, 2)$srcset = $image->srcset(800, 600, ['format' => 'webp']);
// 4. Base64 WebP Low-Quality Image Placeholder (cached in {basename}.lqip.webp)$lqipDataUri = $image->lqip(); // 'data:image/webp;base64,...'Calculating Preset Dimensions Programmatically
Section titled “Calculating Preset Dimensions Programmatically”Use calculate() on the module instance to inspect exact responsive dimensions for any aspect ratio and breakpoint key:
/** @var InterventionImage $imgEngine */$imgEngine = $this->wire()->modules->get('InterventionImage');
// Returns array{width: int, height: int, maxWidth: int, ratio: float}$dims = $imgEngine->calculate(1200, null, 'landscape', 'l');Delayed .queue Rendering & Batch Workers
Section titled “Delayed .queue Rendering & Batch Workers”When 'delayed' is enabled in module options, calling $image->render() or $image->srcset() creates lightweight {variation}.queue sidecar files rather than encoding every breakpoint synchronously during the HTML response.
Process pending .queue files via PHP or a cron-scheduled CLI worker:
# Inspect pending queue count globally or for a single pagephp vendor/bin/wire image:queue --status --jsonphp vendor/bin/wire image:queue --status --page=1024 --json
# Process up to 50 pending variations in batchphp vendor/bin/wire image:queue --limit=50 --json
# Clear pending .queue descriptors without encodingphp vendor/bin/wire image:queue --clear --force --jsonIn PHP:
$inspection = $imgEngine->inspectQueue($page, 50);$result = $imgEngine->processQueue($page, 50);// Or process a single sidecar descriptor directly:$encoded = $imgEngine->processQueueFile('/path/to/yacht.800x600.webp.queue');Expected image:queue --status --json Output
Section titled “Expected image:queue --status --json Output”{ "ok": true, "total": 14, "items": [ { "target": "site/assets/files/1042/aegean-horizon.1200x675.webp", "dimensions": "1200x675", "source": "site/assets/files/1042/aegean-horizon.jpg" } ]}