A product gallery has ten photos, and the template loads them all the same way. The main photo appears late, even though the other angles have already downloaded. Start by measuring the page and finding its LCP element. On a phone, this could be the heading if the main photo is below the fold.
LCP measures when the largest element in the viewport appears — often the main product photo or a large block of text. Suppose a product page has a main image, thumbnails, and hidden slides. First identify the actual LCP element for that page, then change the loading behavior for that element specifically.
Find the LCP element in a page measurement
Open Chrome DevTools → Performance, record a page reload, and select the LCP event on the timeline. In the event details, find the associated element and open it in Elements. If it is a photo, note its currentSrc; if it is a heading, there is no need to start by prioritizing the image.
Check several repeat runs. An unusual run may reflect an unstable server response, cache, or third-party script. Record the selected element, timing, and conditions for each observation before changing loading rules for the whole gallery based on a single number.
Break down the time before the photo appears
In the Network tab, compare the main photo request with requests for the other slides. Record the initiator, priority, and start time. If the important URL is created only after a product data request, note that dependency: the browser cannot preload a source it does not know about yet.
Describe the sequence specifically in the task: “the main photo is added after the API response,” not “the images are slow.” This helps the developer check what changed after the fix and avoids replacing the problem of late discovery with reduced image quality.
Check loading and the actual src
If the actual LCP element is an above-the-fold image, check loading and how the lazy-loading library works. An important visible resource should not wait for the same condition as images far below the fold. Google explains discovery and loading delay in its LCP optimization guide.
Check the source HTML: is there an active URL in src or srcset, or is it stored only in a helper data-src until a script runs? Compare this with the request waterfall. Having picture does not help if the actual image is inserted too late.
Do not automatically disable lazy loading for all photos. The other slides and large images lower down the page serve a different purpose. The solution should distinguish the visible primary resource from the rest, while keeping catalog and product page loading reasonable on a slow connection.
If your measurement confirms that the above-the-fold photo is the LCP element, the markup could look like this:
<img src="/images/product-main.webp" width="640" height="640"
loading="eager" fetchpriority="high" alt="Чёрный светильник L-24">Replace the dimensions and alt with the data for your file. High priority is for a confirmed important resource; do not assign it to every hidden slide. Compare when the request starts in Network before and after the change.
Prioritize the right image
Gallery resources need different loading conditions:
| Resource | Role on initial load | What to check |
|---|---|---|
| Main photo | Shows the product immediately | Early discovery and no unnecessary delay |
| Thumbnails | Let users choose an angle | Accessible controls and appropriate file sizes |
| Hidden full-size slides | Needed after interaction | No unnecessary competition with the primary resource |
| Enlarged original | Needed for detailed viewing | Successful loading in response to user action |
If you use preload, check that it matches the resource selected by the responsive markup. An incorrect preload may download an additional file. Keep a list of requests from before and after to make sure the optimization has not caused duplicate transfers.
Choose a file that fits the display area
Make sure the new format and compression level have not distorted colors or fine details. For clothing, textures, and technical products, these are part of the product page’s quality. Check the same product; do not compare a lightweight photo of a different item with the original image.
The method for choosing image dimensions is covered in the image resizing guide. You can cross-check general LCP work against the guide to this metric. Compare file size and quality separately, then compare the time LCP appears under the same network and screen conditions.
Check the gallery after the change
Check that space is reserved for the photo. If the container gets its height only after loading, the price and order button may shift. This is a separate layout stability issue; a good LCP does not confirm that there are no shifts. In your test results, record both LCP and element shifts if the change affected the gallery dimensions.
On a slow connection, check what happens before the next slide loads. Controls should remain clear, and a missing image should not show a different product or hide information indefinitely. Do not speed up the initial viewport at the cost of breaking the gallery’s main function.
Measure again and test switching slides
Under the same conditions, the important photo is discovered earlier and appears without the previous delay. The gallery displays the other angles, and zoom and product variant selection work. If a text block becomes the new LCP element, record that separately when comparing results.
Read also: Image dimensions, How to improve LCP, Technical audit.