Hello. There is a site on modx revo , installed babel, made 1 additional context (en).
There is a page on which gallery output is displayed; in the case of the default context (web), all the pictures are displayed fine, but if you open the translation of the resource in a different context, the photo is not loaded.

As I understood the whole thing in the paths to the files with photos:

  1. here is the path in the context of the web :

     /assets/components/gallery/connector.php?action=web/phpthumb&ctx=web&w=57&h=57&zc=1&far=C&q=90&src=%2Fassets%2Fgallery%2F3%2F41.jpg 
  2. and here is the path in the context of eng :

      /assets/components/gallery/connector.php?action=web/phpthumb&ctx=eng&w=57&h=57&zc=1&far=C&q=90&src=%2Fen%2F%2Fassets%2Fgallery%2F3%2F41.jpg 

Pay attention to the end of the link:

  1. %2Fassets%2Fgallery%2F3%2F41.jpg

  2. %2Fen%2F%2Fassets%2Fgallery%2F3%2F41.jpg

In en context, he signs - %2Fen (well, or / en)

I want to ask if there is a solution to setting up the gallery for 2 or more contexts? If there is, how to implement it?

Update

You can of course and simply replace add:

 <li> <a class="thumb" name="[[+name]]" href="[[+image:replace=`%2Fen%2F==%2F`]]" title="[[+name]]"> <img src="[[+thumbnail:replace=`%2Fen%2F==%2F`]]" alt="[[+name]]" /> </a> </li> 

But this is a clumsy option. I would like everything in mind)

Here is such a way, too, can be zayuzat in the main Gallery folder line 131 ... rule here for this:

 $itemArray['thumbnail'] = str_replace(array('%2Fen%2F'),'',$item->get('thumbnail',$thumbProperties)); $itemArray['image'] = str_replace(array('%2Fen%2F'),'',$item->get('image',$imageProperties)); 

In principle, this is the same replace, only already inside the plugin.

    1 answer 1

     $itemArray['thumbnail'] = str_replace(array('%2F'.($modx->context->get('key')).'%2F'),'',$item->get('thumbnail',$thumbProperties)); $itemArray['image'] = str_replace(array('%2F'.($modx->context->get('key')).'%2F'),'',$item->get('image',$imageProperties)); 

    or create a snippet getContextKey

     return $modx->context->get('key'); 

    and call in the filter

    [ [+image:replace= % 2F [[getContextKey]]%2F==%2F ] `]