Closed garycrane closed 1 year ago
Retcon is only able to transform local image files, and is not compatible with the Servd Assets transforms. The way the retconTransform
filter works, it'll ignore the entire Servd transform query string (?w=992&h=992
etc.) and just transform the local source image (/images/image.png
).
I have no plans to refactor the retconTransform
filter to support Servd (or external image files in general), but a possible workaround is by using the Imager X plugin for the transforms. Retcon integrates with Imager, and will basically offload the entire transform operation to Imager if it's installed – which I think would solve the problem. See https://servd.host/docs/imager-x-integration
Hi there,
I'm looking for some guidance on how to ensure that retcon processes any chosen transforms within a Redactor field. For example, when adding an image and choosing a 'square' transform in my Redactor field, the image appears to be transformed to a square. However, when rendered in the template, the transform is being ignored. Not sure what I need to do to make sure this doesn't happen. Is this possible? Here is an example:
Source code in Redactor field. See 'square' transform:
<figure><img src="/images/image.png?w=992&h=992&auto=compress%2Cformat&fit=crop&dm=1681893935&s=b6f58875087e239ee874d75cd331aa8b#asset:179769:transform:square" data-image="179769"></figure>
In my template:
{{ entry.content|retconSrcset( [ { width: 430, format: 'webp' }, { width: 768, format: 'webp' }, { width: 992, format: 'webp' }, { width: 1200, format: 'webp' } ], 'img:not([src$=".svg"])', '(min-width: 768px) 80vw, 100vw' )| retconAttr('img', { loading: 'lazy' }) }}
Hope this makes sense. Am I missing something? Any help/guidance would be greatly appreciated.
Craft CMS 4.4.15 Imager X 4.2.1 Host on Servd with Servd Assets