Magento – Magento 2 : Image is not showing on product detail page

frontendmagento2product-images

I have created a product programmatically, and products are uploading successfully but image is not displaying on product detail page here a screen shot.
enter image description here

but image is also showing on homepage and admin area..heres a screeshot
enter image description here

enter image description here

admin area showing the product image too, but not in the detail page?
please suggest a solution.

Best Answer

There are many reasons that could be causing this issue, for ex :

  • On the Product Information page , In your admin backend, under 'Images', make sure the radio buttons have an image selected for 'Base Image', 'Small Image', 'Thumbnail', and that they aren't 'Excluded'.
  • Make sure the product images exist under /media/catalog/product/ (relative to your document root)
  • Make sure the /media directory is in your Apache web server's group. Magento also needs to be able to write to this directory, so you can run this command to set those permissions:
sudo chmod -R 775 /path/to/magento/media
  • In System->Configuration->General->Web , make sure "Base Media URL" is correct under both "Secure" and "Unsecure"
Related Topic