MoreGallery TV - Images with resource specific path return wrong resource id inside path

I’m running moregallery1.16.0 on MODX3.0.4.

Setting up a new project, I started running into problems with a resource specific image paths.

This is my setting for moregallery.source_relative_url: assets/resources/[[+resource]]/gallery/

All images get stored like it is supposed to be:

Problem 1:
I have collection (8) with multiple moregallery child resources (27,28,29,30).

Inside the collection there is a MoreGallery TV where you are supposed to pick a gallery image from each child gallery.

The first image is always displayed, but the following images are always broken because the id part is fixed to the resource id of the first image.

This is how it looks like in the manager:


This is how it should look like:

Problem 2:
Exactly the same happens when I use mgGetImages to retrieve a couple of images by image id that have different resourde ids.

As I normally rewrite the whole paths inside a snippet (it never works like it is supposed to be), this is not really a problem, but inside the manager this is not an option.

Regards, Patrick

Another place where this pops up, but with a twist.

I’m using a snippet to render thumbnails inside a collection:

    display moregallery thumbnail tv
    gallery_thumbnail_imageTpl   = "..[[+mgr_thumb]]"
    gallery_thumbnail_wrapperTpl = "[[+output]]"

if(empty($value)) return "../assets/tpl/images/placeholder-image.png";

$value = explode(',',$value);

$img1 = $value[0];

$thumb = $modx->runSnippet(
        'images' => $img1
        ,'sortBy' => 'selection'
        ,'imageTpl' => 'gallery_thumbnail_imageTpl'
        ,'wrapperTpl' => 'gallery_thumbnail_wrapperTpl'
        ,'limit' => '1'   

return $thumb;

This is the result:

All the broken images contain the id of the image that works (42).

BUT here comes the twist:

There is one collection that works:

It has the same template, collection settings, etc. I can’t see any difference to the other collections.

Theories whats going on here a are very welcome.



Another update. The exception “healed” itself and now it also doesn’t work. I did nothing in the meantime, just reloaded the page the nth time and now it is broken too:

This is the reason for the weird behavior. It was never intended to put placeholders there, though I guess that would’ve worked (sorta by accident) until we made it possible to retrieve images from different resources in a single call.

To get it to work we’ll need MoreGallery to switch resources internally any time it uses the source relative url to make sure it parses that with the right variables. I’m not immediately sure what the side effects of that will be, but I’ve logged an issue (#260) and we’ll look into it.