Skip to content
Catalog & Product Extensions

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
Free $0.00, in stock
Check requirementsSee the versions and themes listed for this package. Details Ask about setupInclude the package name and your Magento and PHP versions. Ask
$0.00
In stock
SKU
panth-productgallery
Links
composer require mage2kishan/module-productgallery
SKU
panth-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.

  1. 1Check the releaseMatch Magento, PHP, theme and dependency requirements.
  2. 2Install on stagingReview Composer changes and follow the package instructions.
  3. 3Configure and verifyUse the documented settings and test the affected features.
magento-root
$ 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 listed2.4.6, 2.4.7, 2.4.8
PHP versions listed8.1, 8.2, 8.3, 8.4
Themes listedHyvä, Luma
Composer packagemage2kishan/module-productgallery

Read package requirements and license

Documentation

Product details and setup guidance. Check the package repository for release-specific instructions.

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, namespace Panth\ProductGallery. Loads after Magento_Catalog, Magento_Store and Panth_Core.
  • Plugin\HideDefaultGallery is an afterToHtml plugin on Magento\Catalog\Block\Product\View\Gallery, declared in etc/frontend/di.xml with sort order 10.
  • Block\Gallery provides getGalleryImages(), getGalleryConfig(), getGalleryConfigJson() and isEnabled(). getTemplate() returns Panth_ProductGallery::hyva/gallery.phtml on Hyvä and Panth_ProductGallery::gallery.phtml on Luma. Block\Widget\Gallery is the widget version.
  • ViewModel\Config exposes the configuration getters and getGalleryConfig(). Helper\Data reads panth_productgallery/ settings.
  • Observer\ProductCollectionLoadAfter on catalog_product_collection_load_after calls addMediaGalleryData() on the collection while the module is enabled.
  • etc/frontend/di.xml adds the module to the registeredModules argument of Panth\Core\ViewModel\ThemeConfig, so etc/theme-config.json is read.
  • ACL resource: Panth_ProductGallery::config. Translations: i18n/en_US.csv. No controllers, routes, web API endpoints, console commands or cron jobs are defined.
More information
Module Category Catalog & Products
Best For All Sizes

Changelog

  1. 1.0.17, 2026-10-30

    • Released under the MIT License: this module is free and open-source software.
  2. 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.
Full history on GitHub

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.

Kishan Savaliya

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.

Ask on WhatsApp