PHPackages                             pagespeedfr/lcpimage - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. pagespeedfr/lcpimage

ActiveMagento2-module[Utility &amp; Helpers](/categories/utility)

pagespeedfr/lcpimage
====================

Magento 2 Lcp preload image on each page / resize image and transform into webp with yireo for google page speed test

1.0.1(11mo ago)191GPL-3.0PHP

Since Jun 4Pushed 11mo agoCompare

[ Source](https://github.com/tweetyx/Pagespeedfr_Lcpimage)[ Packagist](https://packagist.org/packages/pagespeedfr/lcpimage)[ RSS](/packages/pagespeedfr-lcpimage/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (2)DependenciesVersions (2)Used By (0)

Pagespeedfr\_Lcpimage LCP Module for Magento 2: Add preload image support on CMS pages, category pages, product pages, and custom pages with code-based selection, image resizing, 2x support, and compatibility with both Yireo\_Webp2 and Amasty Image Optimizer.

✅ Compatible with Hyvä

Recommendation For optimal Google PageSpeed results and full compatibility with this module, I recommend the free plugin: [👉 Yireo\_Webp2](https://github.com/yireo/Yireo_Webp2)

Features When enabled, the module:

Adds tags for LCP images.

Default Behavior

By default, the module automatically adds a preload link on:

Product pages → preloads the first main product image.

Category pages → preloads the first image in the product listing.

For Other page -&gt; Allows you to choose which image to preload for each controller. Example:

[![image](https://private-user-images.githubusercontent.com/7227725/450774680-acaf39aa-06fa-43d5-a849-d903c17e217d.png?jwt=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3NzU0MjY3NzAsIm5iZiI6MTc3NTQyNjQ3MCwicGF0aCI6Ii83MjI3NzI1LzQ1MDc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dhOTNjODMzY2ZmZTg5YzljOTQyOTliNjFkNjYxNjA0NzI2NjZkOCZYLUFtei1TaWduZWRIZWFkZXJzPWhvc3QifQ.T4EpQCHR5okbhP204k-Tvm-v50Fh30M6ZwyxEaIOdnE)(cms\_index\_index,//main\[@id="maincontent"\]//picture/source,srcset -&gt;here take the first picture on home page of maincontent)

Supports cases where you have separate images for desktop and mobile, for example on the catalog\_category\_view layout.

[![image](https://private-user-images.githubusercontent.com/7227725/451325112-a3c46414-5f5f-46f2-a743-e1b2331a8570.png?jwt=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3NzU0MjY3NzAsIm5iZiI6MTc3NTQyNjQ3MCwicGF0aCI6Ii83MjI3NzI1LzQ1MTMyNTExMi1hM2M0NjQxNC01ZjVmLTQ2ZjItYTc0My1lMWIyMzMxYTg1NzAucG5nP1gtQW16LUFsZ29yaXRobT1BV1M0LUhNQUMtU0hBMjU2JlgtQW16LUNyZWRlbnRpYWw9QUtJQVZDT0RZTFNBNTNQUUs0WkElMkYyMDI2MDQwNSUyRnVzLWVhc3QtMSUyRnMzJTJGYXdzNF9yZXF1ZXN0JlgtQW16LURhdGU9MjAyNjA0MDVUMjIwMTEwWiZYLUFtei1FeHBpcmVzPTMwMCZYLUFtei1TaWduYXR1cmU9MGEzZjM0YzZhMDQyMGRmNGE5ZGZjMGM1MTMxOTk4ZDUwMjZmNmQ3NTZlNmUyYTM0YjdiNzI2MDJmNjg0NTI4OSZYLUFtei1TaWduZWRIZWFkZXJzPWhvc3QifQ.j9doPPlUXFDSqA_8fHE1B_z0pNaiUo6ucgwHYdX93vY)](https://private-user-images.githubusercontent.com/7227725/451325112-a3c46414-5f5f-46f2-a743-e1b2331a8570.png?jwt=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3NzU0MjY3NzAsIm5iZiI6MTc3NTQyNjQ3MCwicGF0aCI6Ii83MjI3NzI1LzQ1MTMyNTExMi1hM2M0NjQxNC01ZjVmLTQ2ZjItYTc0My1lMWIyMzMxYTg1NzAucG5nP1gtQW16LUFsZ29yaXRobT1BV1M0LUhNQUMtU0hBMjU2JlgtQW16LUNyZWRlbnRpYWw9QUtJQVZDT0RZTFNBNTNQUUs0WkElMkYyMDI2MDQwNSUyRnVzLWVhc3QtMSUyRnMzJTJGYXdzNF9yZXF1ZXN0JlgtQW16LURhdGU9MjAyNjA0MDVUMjIwMTEwWiZYLUFtei1FeHBpcmVzPTMwMCZYLUFtei1TaWduYXR1cmU9MGEzZjM0YzZhMDQyMGRmNGE5ZGZjMGM1MTMxOTk4ZDUwMjZmNmQ3NTZlNmUyYTM0YjdiNzI2MDJmNjg0NTI4OSZYLUFtei1TaWduZWRIZWFkZXJzPWhvc3QifQ.j9doPPlUXFDSqA_8fHE1B_z0pNaiUo6ucgwHYdX93vY)

In such cases, you can define a selector like : catalog\_category\_view,//div\[@class="top-container"\]//picture/source2,srcset

The module :

- add, on Cms page and category page admin edit, a field "lcp mobile" and "lcp desktop" if it fill it's that url who is preload.
- look if they are a transformation in webp by amasty or yireo and put it in consequently.
- can resize image with helper $imageHelperLcp = $this-&gt;helper('Pagespeedfr\\Lcpimage\\Helper\\Image'); $imageUrlResize = $imageHelperLcp-&gt;resize($urlimage,$width,$height);
- can transform image in webp with $imageHelperLcp-&gt;webpGoOn($imageUrl2x); using Yireo

🛠 INSTALLATION

Manual Installation

Download and unzip the module in: app/code/Pagespeedfr/Lcpimage/ (Create folders if they don't exist)

With composer : composer require pagespeedfr/lcpimage

Then php bin/magento s:up php bin/magento setup:db-declaration:generate-whitelist --module-name=Pagespeedfr\_Lcpimage

After go to admin &gt; stores &gt; configuration &gt; PAGESPEEDFR &gt; lcpimage and enable it you can add the demo test on homepage for resize banner image webp on module directory : Pagespeedfr/Lcpimage/view/frontend/layout/cms\_index\_index.xml and uncomment the block with name test\_lcp\_image

🔄 Updates For updates, please open an issue on the repository.

OSL-3.0 Licence

###  Health Score

27

—

LowBetter than 49% of packages

Maintenance51

Moderate activity, may be stable

Popularity7

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity36

Early-stage or recently created project

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Unknown

Total

1

Last Release

348d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/70d1caff9915a4c8b5020a4278c888fa10d7b7208268f9ce838a43a22afbd8dc?d=identicon)[matritix](/maintainers/matritix)

---

Top Contributors

[![tweetyx](https://avatars.githubusercontent.com/u/7227725?v=4)](https://github.com/tweetyx "tweetyx (17 commits)")

### Embed Badge

![Health badge](/badges/pagespeedfr-lcpimage/health.svg)

```
[![Health](https://phpackages.com/badges/pagespeedfr-lcpimage/health.svg)](https://phpackages.com/packages/pagespeedfr-lcpimage)
```

###  Alternatives

[symfony/ux-turbo

Hotwire Turbo integration for Symfony

3906.8M47](/packages/symfony-ux-turbo)[spiral/attributes

PHP attributes reader

233.6M45](/packages/spiral-attributes)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
