Custom Product Image Gallery for Magento 2
Replaces the Magento 2 product page gallery with horizontal, vertical or grid thumbnails, hover zoom and a fullscreen lightbox with keyboard and swipe navigation. Separate templates for Hyvä and Luma.
- Free
- Themes listed: Hyvä + Luma
composer require mage2kishan/module-productgallery
- Package requirementsRead the source documentation
- Developer profileView Upwork profile
- Themes listedHyvä + Luma
- PHP versions listed8.1, 8.2, 8.3, 8.4
- Installation questionsDiscuss your store setup
What it does for your store
The main features, as listed in the module documentation.
-
Three thumbnail layouts
A strip below the main image, a column on the left, or a grid that shows every image.
-
Hover zoom
The large image follows the cursor at 3x by default. Mouse only, so taps on phones do not leave it zoomed.
-
Fullscreen lightbox
Image counter, zoom buttons, mouse wheel zoom, arrow keys and Escape, with focus kept inside the dialog.
-
Arrows and swipe
Prev and next arrows, an optional loop from the last image to the first, and swipe on touch screens.
-
Follows product options
Changes images when a shopper picks a configurable option, on Hyvä and on Luma swatches.
-
Hyvä and Luma
Alpine.js and Tailwind on Hyvä, plain JavaScript on Luma. No layout overrides needed.
Installation
Example commands from the Magento root. Follow the package instructions and your staging and deployment process.
- 1Check the releaseMatch Magento, PHP, theme and dependency requirements.
- 2Install on stagingReview Composer changes and follow the package instructions.
- 3Configure and verifyUse the documented settings and test the affected features.
$ composer require mage2kishan/module-productgallery $ bin/magento setup:upgrade $ bin/magento setup:di:compile $ bin/magento setup:static-content:deploy -f $ bin/magento cache:clean
Listed requirements
These are the details supplied in this listing. Confirm the selected release supports your Magento edition, PHP and storefront.
| Magento versions listed | 2.4.6, 2.4.7, 2.4.8 |
|---|---|
| PHP versions listed | 8.1, 8.2, 8.3, 8.4 |
| Themes listed | Hyvä, Luma |
| Composer package | mage2kishan/module-productgallery |
Documentation
Product details and setup guidance. Check the package repository for release-specific instructions.
A different product image gallery without theme work
Product Gallery replaces the image gallery on the Magento 2 product page. A plugin on the core gallery block swaps its output for the module template when the module is enabled. Turn the module off and Magento shows its default gallery again. If a product has no enabled images, or the template fails to render, the original gallery is returned.
The module ships two templates and picks one from the active theme through Panth Core: an Alpine.js and Tailwind template for Hyvä, and a plain JavaScript template for Luma. No layout XML changes are needed.
Layouts
- Horizontal: the main image with a strip of thumbnails below it.
- Vertical: thumbnails in a column on the left from 1024 px on Hyvä and 768 px on Luma, and below the image on smaller screens.
- Grid: every image at once, 2 columns on phones and 3 on larger screens. Clicking an image opens the lightbox.
The main image is rendered by the server with width, height and fetchpriority set, so it shows before any script runs and does not move the layout. Thumbnails after the first image load lazily.
Zoom, lightbox and navigation
Hovering over the main image shows the large image scaled 3x, with the zoom following the cursor. The zoom level is set in config.xml and limited to 2 to 5. There is no lens or magnifier window.
Clicking the main image opens a fullscreen lightbox with the large image, an optional "1 / 5" counter, zoom in and out buttons, mouse wheel zoom and a close button. With keyboard navigation on, the arrow keys move between images, Escape closes and the plus and minus keys zoom. The lightbox is a labelled dialog that keeps focus inside it and returns focus to the main image when closed.
On the main image you can show prev and next arrows, turn on a loop from the last image back to the first, and allow swipe on touch screens.
Configurable products
On Hyvä the gallery listens for the events sent by the configurable options script and swaps in the images of the selected child product. On Luma it exposes the small gallery API that Magento swatch and drop-down scripts call, so it follows option changes and restores the parent images on reset. Product videos are not shown by this gallery.
Alt and title text
Each image gets alt and title attributes from the core gallery images data: the image label, or the product name when there is no label. A module that rewrites that data, such as Panth Image SEO with its gallery JSON option, changes the alt and title here too.
Settings
Stores > Configuration > Panth Extensions > Product Gallery has switches for the module, the thumbnail layout, zoom, the lightbox, the image counter, keyboard navigation, arrows, swipe and the loop. Every setting can be set per website and store view. The module creates no database tables.
Requirements
- Magento Open Source or Adobe Commerce 2.4.4 to 2.4.8.
- PHP 8.1 or later.
- mage2kishan/module-core, installed by Composer.
- Hyvä or Luma storefront.
Free and open source under the MIT License.
Developer notes
These names are from release 1.0.17 of the package.
- Module
Panth_ProductGallery, namespacePanth\ProductGallery. Loads afterMagento_Catalog,Magento_StoreandPanth_Core. Plugin\HideDefaultGalleryis anafterToHtmlplugin onMagento\Catalog\Block\Product\View\Gallery, declared inetc/frontend/di.xmlwith sort order 10.Block\GalleryprovidesgetGalleryImages(),getGalleryConfig(),getGalleryConfigJson()andisEnabled().getTemplate()returnsPanth_ProductGallery::hyva/gallery.phtmlon Hyvä andPanth_ProductGallery::gallery.phtmlon Luma.Block\Widget\Galleryis the widget version.ViewModel\Configexposes the configuration getters andgetGalleryConfig().Helper\Datareadspanth_productgallery/settings.Observer\ProductCollectionLoadAfteroncatalog_product_collection_load_aftercallsaddMediaGalleryData()on the collection while the module is enabled.etc/frontend/di.xmladds the module to theregisteredModulesargument ofPanth\Core\ViewModel\ThemeConfig, soetc/theme-config.jsonis read.- ACL resource:
Panth_ProductGallery::config. Translations:i18n/en_US.csv. No controllers, routes, web API endpoints, console commands or cron jobs are defined.
| Module Category | Catalog & Products |
|---|---|
| Best For | All Sizes |
Changelog
-
1.0.17, 2026-10-30
- Released under the MIT License: this module is free and open-source software.
-
1.0.16, 2026-10-07
- Storefront colours follow the store palette on Hyvä and Luma: image and thumbnail backgrounds #FAFAFA (were #F9FAFB and #F3F4F6), borders #E5E5E5 (were #E5E7EB), thumbnail borders #D4D4D4 with #525252 on hover (were #9CA3AF and #4B5563).
- The default gallery CSS variables use the same values: border and thumbnail border #E5E5E5, muted text #525252.
FAQ
Does this replace Magento's default product gallery?
Yes, on the product page. An afterToHtml plugin on the core gallery block renders the module template instead, the Hyvä one or the Luma one depending on the theme. When the module is disabled, or a product has no enabled images, Magento shows its own gallery.
Does it work with configurable product swatches?
Yes. On Luma the gallery takes over the gallery API that Magento's swatch and drop-down scripts call, so the images change with the selected option and reset with the parent product. On Hyvä it listens for the update-gallery and reset-gallery events.
Does it work with video (YouTube / Vimeo)?
No. This gallery shows images only. When it replaces the Luma gallery, the core product video block is not rendered, so product videos do not appear on the product page.
Is Hyvä compatible?
Yes. The Hyvä template is an Alpine.js component with Tailwind classes and no jQuery. The module picks it automatically when the store runs a Hyvä theme.
Does it affect Core Web Vitals?
The main image is rendered by the server with width, height and fetchpriority="high", and other images load lazily, so the gallery does not shift the layout while scripts start. Measure your own pages before and after, because results depend on the theme and the images.
Can I override the template in my child theme?
Yes. Copy Panth_ProductGallery/templates/gallery.phtml (Luma) or Panth_ProductGallery/templates/hyva/gallery.phtml (Hyvä) into your theme and edit the copy.
Does it support multi-store and multi-language?
Yes. Every setting can be set at default, website and store view scope, and the storefront strings are translatable through the en_US.csv file.
Does it require Panth Advanced SEO?
No. Alt and title text come from the core gallery data. If you want template based alt text, Panth Image SEO can write it into that data and the gallery will use it.
Questions before you install?
Send me your composer.json and I will check for conflicts first. Free. Installation is +$45, custom work is quoted first.