I have been struggling with this catalog images in product page from over 10 days now. The same question I raised on stackexchange too, please see the question here
On certain images my end user complained that the images in product detail page are missing for certain products. So, I tried to reproduce the issue. I deleted all the images from one of the product that was having problem. Added images back from admin panel and saved the product.
refresh that product page in frontend and image came back. Now I clear cache on Flush Catalog Image Cache option from admin panel, check the page again and images were again missing.
Note: this is happening with certain products only.
To get all the product images generated again, I already did
php bin/magento catalog:image:resize
But as soon as I flush catalog images, the same problem comes back.
I further investigated the problem and tried below remedies too but none of them is working for me:
sudo chmod -R 777 var/cache
sudo chmod -R 777 pub/media
I checked .htaccess file inside media folder which is there.
I did a small comparison between the product that is showing images and one that is not showing. All I find is the missing images product was having just one copy of image. So I can understand catalog cache images for certain products are not getting generated.
I am using Magento ver. 2.3.5-p1 on Ubunto 18.04 on GCP
I hope the information is sufficient for you folks to understand the error and solve it.
All I can understand is Magento is not generating images for cache one loading for the first time.
Hope you guys have the solution.
Regards
Jay