1

we have created some category's custom attribute of WYSIWYG editor type. While we are adding image in these custom attribute's editor, they are showing/loading fine in admin section but while we are fetching these attributes data on frontend, images are not loading.

Magento making image url on frontend like - <img src="{{media url=&quot;handmade-thumb.jpg&quot;}}" alt="" />

Its picking image url as text.

Please help me to solve this issue.

1 Answer 1

7

You need to filter that content using cms page filter.

Try following way:


public function __construct(
    \Magento\Cms\Model\Template\FilterProvider $filterProvider
) {
    $this->_filterProvider = $filterProvider;
}

Now use:


$this->_filterProvider->getPageFilter()->filter($content);
2
  • Hie @Sohel Rana here $content means what? Aug 13, 2020 at 7:36
  • Thanks for solution. It is working fine. Mar 22, 2021 at 21:20

Your Answer

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

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