0
votes

We're working with Magento 2.2.8, we added product attribute using WYSIWYG editor in admin panel. Image is showing perfect with admin url.

<img src="{{media url=" wysiwyg="" u4888.png"}}"="" width="400" height="400">

But, in product detail page, it's not showing image. It seems like media is not rendering.

Please check below code, the media url is not changing to dynamic url as its doing in admin.

<div class="col-md-4 custom-accordion__col">
    <img src="{{media url=" wysiwyg="" u4888.png"}}"="" width="400" height="400">
</div>

Your help is highly appreciated.

Thanks, Saikat

2

2 Answers

0
votes

Whenever I add an image using WYSIWYG, the output I usually see looks something like this:

<img src="{{media url="wysiwyg/folder/image.png"}}" alt="" />

In your case, if the image is uploaded using WYSIWYG, the URL should look like this:

<img src="{{media url="wysiwyg/u4888.png"}}" width="400" height="400">

Hope this helps!

0
votes

I just found the solution. So, in display block section we have to put below codes:

$_helper = $this->helper('Magento\Catalog\Helper\Output');

$_product = $block->getProduct();

<?=$_helper->productAttribute($_product, $product->getData('quality_n_materials'), 'quality_n_materials') ?>

Thanks, Saikat