mmikkel / Retcon-Craft

A collection of powerful Twig filters for modifying HTML
MIT License
79 stars 9 forks source link

Undefined array key "width" #43

Closed espensgr closed 2 years ago

espensgr commented 2 years ago

Seems to be an error in the latest release

image

I'm using the retconSrcset in an Article Editor field with an asset added to that.

{{ block.innhold
| retconSrcset(
    [{ width: 400 },{ width : 800 },{ width : 1024 }],
    'img','100vw',true, {format: 'webp'}
) | retconRenameAttr('img', {
    srcset: 'data-srcset',
    sizes: 'data-sizes'
}) | retconAttr('img', {
    class: 'lazyload'
}) }}

Any settings added returns the same error, and the setup has worked until the last release.

Retcon 2.4.3 Craft 3.7.51 Imager-x 3.6.2 php 8.0.8

mmikkel commented 2 years ago

What kind of an image is it (i.e. its extension)?

mmikkel commented 2 years ago

Nevermind, that code should've been more defensive :)

Just released Retcon v. 2.5.0, which should resolve the problem.