Markus Michalski FAQ

CDN Product Images: Shop API

Shop API/headless behaviour of the Sylius plugin CDN Product Images: context-correct resizing on the API Platform channel too.

Deutsche Version

Back to overview

CDN Product Images: Shop API

This documentation always describes the latest published version.

Live Demo: Try this and other plugins live — no installation, no risk: demo.markus-michalski.net

Dual-mode

This plugin is dual-mode: CDN image URLs are freshly re-signed per rendering context identically on the Twig storefront/Admin and on the headless Shop API channel (API Platform) - not through a new endpoint, but by decorating the existing image normalizer.

graph LR
    A["Storefront/Admin Twig imagine_filter"] --> C["ImgproxyUrlSigner"]
    B["Shop API image delivery"] --> C
    C --> D["Admin CDN Integration settings"]
    D --> E["mm-media-cdn Signing Service"]
    E --> F["Twig render"]
    E --> G["JSON response"]

Behaviour

Example

curl "https://shop.example.com/api/v2/shop/products/mug-sw?imageFilter=sylius_shop_product_large_thumbnail"

For a CDN image, the returned image field carries a freshly signed mm-media-cdn URL sized for sylius_shop_product_large_thumbnail instead of the unchanged URL that was entered.

Error format

This plugin introduces no error format of its own: a failed signing attempt (network error, timeout, non-2xx) never produces an API error - it degrades to the unchanged, unsigned URL that was entered. A working (if not optimally sized) image always beats a broken one.