Closed espensgr closed 1 year ago
The thing is that (AFAIK) Imager can transform SVGs, it depends on the transformer its using. In most cases though, I guess it isn't able to (and you wouldn't want it to), so as a default behaviour it'd probably make sense if Retcon didn't attempt to transform SVGs at all.
I'll have a think on how to approach that – but in the meantime, a quick workaround is to use the Retcon selector to avoid transforming any SVG files, i.e. something like this (note the 'img:not([src$=".svg"])'
):
{{ entry.redactorField|retconSrcset(
[
{width: 375},
{width: 480},
{width: 768}
],
'img:not([src$=".svg"])',
'(min-width: 40em) 80vw, 100vw'
) }}
that makes sense, thanks for the solution, will implement it 👍
Circling back to this, I think I found a decent solution.
From the next release forward, Retcon will respect Imager's safeFileFormats
setting (defaults to ['jpg', 'jpeg', 'gif', 'png']
when using Imager to transform images. I.e. the retconTransform
and retconSrcset
filters will no longer attempt to transform SVGs or other non-safe formats, unless those formats have been added to the safeFileFormats
setting in Imager's config file.
Hi, we have a project with Imager and Retcon plugins. We recently upgraded the Retcon plugin to the version 2.7.0
and found that it's giving errors on image transforms:
@anita-chouhan Responded in a new issue: https://github.com/mmikkel/Retcon-Craft/issues/66
We are using the
retconSrcset
on a redactor field, that can add images. If you add an svg it fails as imager-x cant do that. Is it possible to skip svg files in the selector forretconSrcset
? Or is this an imager-x setting, or bug?