Image Optimizer for Magento 2
Control image-loading attributes, eager exclusions and browser loading hints in Magento. This package changes page markup and DOM behaviour; it does not convert or compress image files.
- Free
- Themes listed: Hyvä + Luma
composer require mage2kishan/module-imageoptimizer
- 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.
-
Image loading attributes
Use native or hybrid loading attributes in eligible rendered HTML.
-
Eager exclusions
Keep a configured first-image count eager rather than guessing viewport position.
-
Optional browser controls
Use supported DOM loading, decoding and preload settings.
-
File formats stay separate
WebP detection and fallback do not convert, compress or generate source images.
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-imageoptimizer $ 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-imageoptimizer |
Documentation
Product details and setup guidance. Check the package repository for release-specific instructions.
Overview
Panth Image Optimizer controls how existing images are loaded in a Magento storefront. Configure loading attributes, first-image exclusions and browser hints, then inspect the important images on product, category and content pages.
What you get
- Native, Intersection Observer and Hybrid loading strategies.
- A configured first-image count kept eager.
- Optional decoding, preload and fetchpriority controls.
- Browser WebP support detection and fallback handling for existing picture markup.
Magento 2 Image Optimizer
This page describes published mage2kishan/module-imageoptimizer 1.0.12. It changes loading HTML and browser DOM behaviour. It does not convert or compress files, create responsive variants or rewrite image URLs. Use Image SEO for the separate semantic image-metadata task.
Features
Choose loading behaviour based on the page's actual images. Browser lazy loading can defer offscreen images, but important visible images need timely discovery. The module's first-N rule counts eligible image order; it does not measure which images are above the fold on every device.
Usage
Use representative product, category and content pages to check the configured behaviour. Test enabled and disabled states, existing attributes and interactions with other extensions before widening a rollout.
Server-side (PHP plugins), strategies Native and Hybrid
The final-output plugin processes eligible img tags, skips comments and protected script/style/template-like content, and uses document order for eager exclusions. It preserves existing loading attributes except eligible early loading=lazy values can become eager. A product-image plugin also adds lazy loading when the attribute is absent.
Client-side (inline script)
Intersection Observer mode watches existing img[data-src] elements and transfers data-src/data-srcset when they approach the viewport. The plugins do not create that data markup. The browser controls run on the current DOM; test dynamically inserted gallery or content images separately. Keep the important LCP image readily discoverable, as explained in Google's LCP guide.
Documentation
Use the pinned release README alongside the owning helper, template and plugin code. Later main-branch documentation can differ from this release.
Changelog
Read the package release notes before changing versions and compare them with the Composer version and source reference. Check dependency and configuration changes before upgrading.
Compatibility
The 1.0.12 manifest declares PHP >=8.1 and the Magento component requirements in the release source. These dependency declarations and upstream theme statements are not a tested edition/version/theme matrix. The README table partly cites this product page, so it is not independent compatibility evidence. Match your platform to Adobe's version-specific system requirements and test your actual combination.
Requirements
Composer requires mage2kishan/module-core:^1.0 and the Magento components listed in this release's manifest. Review the declared PHP extensions and the relevant frontend integrations before installation. A successful dependency resolution does not replace functional testing.
Installation
Choose the package version you intend to deploy and install it on a staging copy first. The commands below identify the module; compile and static asset steps depend on your deployment mode. Follow Adobe's extension workflow and your project release process.
composer require mage2kishan/module-imageoptimizer
bin/magento module:enable Panth_Core Panth_ImageOptimizer
bin/magento setup:upgrade
bin/magento setup:di:compile
bin/magento cache:clean
bin/magento module:status Panth_ImageOptimizer
Configuration
Select the intended default, website or store view scope, then review the relevant controls below. Change one capability at a time and compare the generated output or request results with the original behaviour.
General Settings
The master switch and debug mode default to No. Select the intended store scope before enabling the loading plugins or browser script.
WebP Detection (Frontend Only)
When enabled, the script tests browser WebP support with a canvas. If support is absent and fallback is enabled, it removes WebP source elements inside picture elements so the fallback image can be used. Both switches default to Yes under the master switch. Existing source files and fallback markup must already be valid.
Lazy Loading
Lazy loading defaults to enabled with the Native strategy. Native and Hybrid activate the PHP attribute plugins; Intersection Observer and Hybrid run the browser observer for images already marked with data-src. The supplied eager exclusion is the first three eligible images. The placeholder choice is passed in configuration but the shipped script does not render a placeholder.
Performance Settings
The browser script can append preload links for the configured first images and set decoding=async. The layout plugin can add fetchpriority=high to the first eager image; the browser script can also set priority for preloaded images. These are loading hints, not proof of earlier delivery or a faster LCP. Preload links are inserted when the script runs, so verify their timing in the actual page.
Uninstallation
Review dependants and capture rollback data before disabling or removing the package. Removing code does not by itself establish that settings, stored logs or generated/cache data have been removed. Follow the exact release notes and a reviewed removal plan.
bin/magento module:disable Panth_ImageOptimizer
composer remove mage2kishan/module-imageoptimizer
bin/magento setup:upgrade
bin/magento setup:di:compile
bin/magento cache:clean
License
This published release declares MIT and includes the MIT notice. Keep that notice when redistributing the software; see the release licence. This statement does not apply current terms to older releases or promise future updates, support or performance results.
Developer Notes
The module is Panth_ImageOptimizer. Review Plugin/Layout/LazyLoadingPlugin, Plugin/Image, the shared RequestImageCounter and the frontend template when integrating theme output. For reserving image dimensions, compare the narrower Performance Optimizer controls. Avoid applying several loading implementations to the same markup without checking the result.
| Module Category | Performance |
|---|---|
| Best For | All Sizes |
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.