Skip to content

Utilizing Prismics Imgix integration to transform images

Peter Jaap Blaakmeer edited this page Nov 20, 2020 · 2 revisions

Prismic uses Imgix to serve the images. You are able to append query parameters to the image URL to perform transformations on the image.

For example;

<img src="<?= $block->getChildHtml('author.document.photo') . '&' . http_build_query([
            'w' => 500,
            'h' => 500,
            'fit' => 'facearea',
            'facepad' => 4
        ]); ?>"/>

This will resize the author's photo to 500x500 pixels, and it will zoom in on the face a bit. A more in-depth explanation by Prismic can be found here; https://user-guides.prismic.io/en/articles/3309829-image-optimization-imgix-integration

Clone this wiki locally