1

I have a Question about image transform focal point behavior.

Twig templating or with php. Getting the url of an asset with a transform $asset->getUrl('transformer')

If i am understanding the documentation correctly and my testing was not faulty. One has to implement caching busting himeself if changing the focal point of an image or changing the transformer settings. Because the url never changes in both cases, the browser will cache those images and not pull the newly generated ones. Am i correct on this one or am i missing something?

2 Answers 2

1

As pointed out on the official Discord by a Gentleman named "Thanasis Psarros" the following general configuration enables this feature:

https://craftcms.com/docs/5.x/reference/config/general.html#revasseturls

(maybe their are some downsides to this that we did not notice right now)

1

Craft's native transform URLs doesn't include any information about the focal point, which means that updating the focal point will not result in the final transform URL being changed, and browser caches might serve up previously generated transforms for returning visitors.

The revAssetUrls setting offers a solution to the problem by adding a modified timestamp to all asset URLs.

Another solution is to eschew Craft's native transforms for the Imager X plugin. Unlike Craft's core transforms, Imager will add information about the asset focal point to its transform URLs, ensuring that the URL changes if and when asset focal points are changed.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.