<![CDATA[ runSnippet getImageList inside getResources (for Collections imageRenderer) - My Forums]]> https://forums.modx.com/thread/?thread=103464 <![CDATA[runSnippet getImageList inside getResources (for Collections imageRenderer)]]> https://forums.modx.com/thread/103464/runsnippet-getimagelist-inside-getresources-for-collections-imagerenderer#dis-post-556681 SOLVED - SEE FIRST ANSWER

I am trying to set up a custom imageRenderer Snippet for my Collections view. I want to display the first image of a MIGX-TV which hosts some images.

So I made this Snippet:
$row = $modx->getOption('row', $scriptProperties, '');
$rowId = $row['id'];

$modx->setPlaceholder('getId', $rowId);

$gR = $modx->runSnippet('getResources', [
'parents' => '-1',
'resources' => $rowId,
'tpl' => 'ref-image-id'
]);

return '<a href="[[++site_url]]manager/?a=resource/update&id=' . $row['id'] . '" title="' . $row['pagetitle'] . '"><img src="' . $gR . '" width="60" ></a>';


In my Chunk ref-image-id I have this (only works cached):
[[getImageList?
&tvname=`ref-images`
&tpl=`ref-image-item`
&docid=`[[+getId]]`
&limit=`1`
]]


The ref-image-item Chunk:
[[++site_url]][[+image]]


On my Collections view all of the images have the path of the first resource. The image itself ([[+image]]) is correct.
What I get is:

path/of/resource-1/car.jpg
path/of/resource-1/flower.jpg
path/of/resource-1/house.jpg

when it should be:

path/of/resource-1/car.jpg
path/of/resource-2/flower.jpg
path/of/resource-3/house.jpg

I have tried this without the placeholder and inside my getImageList call using &docid=`[[+id]]` - same problem.]]>
aaantz Feb 02, 2018, 09:04 PM https://forums.modx.com/thread/103464/runsnippet-getimagelist-inside-getresources-for-collections-imagerenderer#dis-post-556681
<![CDATA[Re: runSnippet getImageList inside getResources (for Collections imageRenderer) (Best Answer)]]> https://forums.modx.com/thread/103464/runsnippet-getimagelist-inside-getresources-for-collections-imagerenderer#dis-post-556684 SOLVED

https://forums.modx.com/thread/80762/getimagelist-used-in-getresources-rowtpl-only-shows-data-from-first-item#dis-post-484671

I changed the Media Source:

[[!migxResourceMediaPath? &pathTpl=`assets/resourceimages/{id}/`]]
instead of
[[migxResourceMediaPath? &pathTpl=`assets/resourceimages/{id}/`]]]]>
aaantz Feb 02, 2018, 09:50 PM https://forums.modx.com/thread/103464/runsnippet-getimagelist-inside-getresources-for-collections-imagerenderer#dis-post-556684