Modifying Kirby editor plugin image snippet with srcset throws error

I’m modifying the ‘image’ snippet of the standard Kirby Editor plugin (v1.0.4) but getting an exception error when I append ‘srcset()’ to the image ‘$src’.

<?php if ($block->isNotEmpty()): ?>
<figure<?= attr(['class' => $attrs->css()->value()], ' ') ?>>
  <?php if ($attrs->link()->isNotEmpty()): ?>
  <a href="<?= $attrs->link()->toUrl() ?>">
    <img 
      src="<?= $src ?>" 
      alt="<?= $attrs->alt() ?>"
      sizes="(min-width: 600px) 50vw, 600px"
      srcset="<?= $src->srcset() ?>"
>
  </a>
  <?php else: ?>
  <img 
    src="<?= $src ?>" 
    alt="<?= $attrs->alt() ?>"
    sizes="(min-width: 600px) 50vw, 600px"
    srcset="<?= $src->srcset() ?>"
  >
  <?php endif ?>

  <?php if ($attrs->caption()->isNotEmpty()): ?>
  <figcaption>
    <?= $attrs->caption() ?>
  </figcaption>
  <?php endif ?>
</figure>
<?php endif ?>

$src is just a string, containing the url I guess, so you cannot can the file method srcset on it. You need a file object.

You should have access to the image through the $image variable, though.

Yes! That did it, thanks for the quick reply!