5

remove image

I need to remove the image title/name below from product view pages. Magento version 2.2.5. Anyone know how do this?

The expectation is without title/name :)

10
  • Are you using any theme? Commented Jul 25, 2018 at 8:26
  • please try to remove label name of image
    – pramod24
    Commented Jul 25, 2018 at 8:33
  • i am using porto theme. @SukumarGorai
    – Kean
    Commented Jul 25, 2018 at 9:12
  • @pramod24 do you where to remove label name of image? default didn't give name for image upload on backend.
    – Kean
    Commented Jul 25, 2018 at 9:12
  • @pramod24 It will not work. Commented Jul 25, 2018 at 9:19

4 Answers 4

3

You need to override the fotoroma.js from location to your module:

lib/web/fotorama/fotorama.js

Then find showcaption and captions, then set those to false.

Now need to run static content deploy.

I have edited the

lib/web/fotoroma/fotoroma.js

directly This solved my problem.

3
  • ,can you tell please how to remove product image scroll in details page in fotorama.js Commented Jan 18, 2019 at 12:13
  • Post a question with screenshot, definitely members will answer. Commented Jan 18, 2019 at 12:24
  • it is not working Commented Nov 30, 2020 at 11:05
0

Try this:

Create a custom module with below code.

app/code/Vendor/Module/etc/frontend/di.xml

With below code.

<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd">
    <type name="Magento\Catalog\Block\Product\View\Gallery">
        <plugin name="get_gallery_images_json_captions" type="Vendor\Module\Plugin\Gallery"/>
    </type>
</config>

Now plugin file

app/code/Vendor/Module/Plugin/Gallery.php

With below code.

<?php

namespace Kunj\Gallery\Plugin;
class Gallery
{
    public function afterGetGalleryImagesJson(
        \Magento\Catalog\Block\Product\View\Gallery $subject,
        $result
    ) {
        $galleryOptions = json_decode($result,1);
        foreach ($galleryOptions as $k => $options)
        {
            if(isset($galleryOptions[$k]) && isset($galleryOptions[$k]['caption']))
            {
                $galleryOptions[$k]['caption'] = "";

            }
        }
        return json_encode($galleryOptions);
    }
}

Now flush the cache and deploy static content.

2
  • just try it, it doesn't work, i guess somethings about fotorama.
    – Kean
    Commented Jul 25, 2018 at 15:28
  • Actually, magento display that data from $data varibale wich is in gallery.phtml file and there's bug in magento 2 as if we set caption false in current theme etc/view.xml file under var section. Did you create custom module?
    – kunj
    Commented Jul 25, 2018 at 18:23
0

Just add to your custom css.

.fotorama__caption{
    visibility: hidden !important;
} 
0

I am also using magento 2 and Porto theme, for people who needs to do it via CSS can follow the following steps:

  • Goto Store > Configurations > Porto theme Settings Panel > Custom CSS

Add following css.

.fotorama__caption__wrap{
display:none !important;

}

After that clear the cache of magento and browser. The caption/label now must be hidden.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.