diff --git a/core/components/gallery/model/gallery/galleryalbumsmediasource.class.php b/core/components/gallery/model/gallery/galleryalbumsmediasource.class.php index 25c00b4..912b1df 100644 --- a/core/components/gallery/model/gallery/galleryalbumsmediasource.class.php +++ b/core/components/gallery/model/gallery/galleryalbumsmediasource.class.php @@ -180,6 +180,15 @@ public function getObjectsInContainer($path) { 'fullRelativeUrl' => $itemArray['relativeImage'], ); } + + $modx_version = $this->xpdo->getVersionData(); + if (version_compare($modx_version['full_version'], '2.8.0-pl') >= 0) { + // For MODX versions newer or equal to 2.8.0, undo any ampersand encoding (as it will be done in JS) + $list = array_map(function($item) { + $item['thumb'] = str_replace('&', '&', $item['thumb']); + return $item; + }, $list); + } } return $list; } diff --git a/core/components/gallery/src/Model/GalleryAlbumsMediaSource.php b/core/components/gallery/src/Model/GalleryAlbumsMediaSource.php index 65d9184..d9b3454 100644 --- a/core/components/gallery/src/Model/GalleryAlbumsMediaSource.php +++ b/core/components/gallery/src/Model/GalleryAlbumsMediaSource.php @@ -187,12 +187,13 @@ public function getObjectsInContainer($path) { 'image' => $item->get('image'), 'image_width' => $imageWidth, 'image_height' => $imageHeight, - 'thumb' => $item->get('thumbnail'), + 'thumb' => str_replace('&', '&', $item->get('thumbnail')), 'thumb_width' => $thumbWidth, 'thumb_height' => $thumbHeight, 'url' => $itemArray['image'], 'relativeUrl' => $itemArray['relativeImage'], 'fullRelativeUrl' => $itemArray['relativeImage'], + 'preview' => 1 ); } }