I think it’s just my lack of php knowledge.
When I fill the $s1x with just a number, it works.
But if it’s astring it won’t. The Error message:
Argument #1 ($width) must be of type ?int, string given
I tried diffrent ways to «convert» the string into an integer but without success.
// template
<?php snippet("picture", [
'image' => $image,
's1x' => $s1x = "null,100",
's2x' => $s2x = "null,200",
]) ?>
// snippet
<picture>
<?php
$i1x = $image->resize($s1x)->url();
$i2x = $image->resize($s2x)->url();
?>
<source media="(max-width: 700px)" srcset="<?= $i1x ?> 1x, <?= $i1x ?> 2x">
<source srcset="<?= $i1x ?> 1x, <?= $i2x ?> 2x">
<img src="<?= $i1x ?>" alt="">
</picture>
Is this feasible?