Skip to content

Skip loading and showing certain images in fotorama.js

Magento 2.4.6

I have a very specific requirement. I want to not load images in the media gallery on the product page, if the image is a placeholder. Do not ask why :-D, its a requirement and can not be solved any other way (it does not work to hide the image via admin in my case).

So I checked out the loadImg function in fotorama.js and managed to not load the image, but it still creates the space for the image in the thumbnails of the media gallery. I want to completely not load the image in case the image to be loaded is a placeholder.

This is my approach in loadImg:

if (src.includes('placeholder/thumbnail')) {
    return;
}

The image wont be loaded now, but like I said, the space for it is still visible and clickable in the thumbnails.

Any idea how to achieve that?