Shopify plugin - Resizing thumbnails problem

Hello @ tristantbg,
today i tried your Shopify plugin for the first time, and surprisingly it worked from the start.
Thanks a lot for this genius plugin.

The only trouble i am having right now is this:
In you document you mention the possibility of resizing thumbnails via ‘img_url’ attributes. This doesn’t seem to work in my install.

I can display the images from shopify as they are, using the toStructure route… But as soon as i add
->img_url('1000x1000'),

nothing happens.
If i use it as you did in your document:
<?= $page->shopifyImages()->toStructure()->first()->img_url('1000x1000') ?>)
i get this var_dump result:
object(Kirby\Cms\Field)#466 (1) { ["img_url"]=> NULL }

The only time i am getting some changes regarding the resizing is, when i apply it to the whole set of images ($page->shopifyImages()). But, this turns the collection into a string that i can’t loop through anymore…

Also, if i would want to use this here:

<?= $page->shopifyImages()->toStructure()->first() ?>

i actually need to write it like this:

<?= $page->shopifyImages()->toStructure()->first()->src() ?>

maybe something changed in how Shopify delivers the media informations in the meanwhile?

I found a solution to my problem:

<?= $page->shopifyImages()->toStructure()->first()->src()->img_url('1000x1000') ?>

is doing the trick…

2 Likes