I have a custom module to update Faq of the website.question and answers can update from the back-end.Answer field is wysiwyg editor.Can upload image to the answer content.
If i get the result using graphQl , for the answer which have image retrieving the image path as below.
<img src=\"{{media url="wysiwyg/what_next.jpg"}}\" alt=\"\" width=\"560\" height=\"460\">
If i use this in front end the image is broken.Image is not showing.
My GraphQl query
type Query {
faqs : [Faqs] @resolver( class: "Ayakil\\Faq\\Model\\Resolver\\Faq") @doc(description: "Get list of active answered FAQS")
}
type Faqs {
id : Int @doc(description: "Id")
question : String @doc(description: "Question")
answer : String @doc(description: "Answer")
}
My resolver File
public function getFaq( )
{
try {
$collection = $this->_faqFactory->create()->getCollection();
$collection->addFieldToFilter('faq_active',1);
$collection->setOrder('short_order', 'ASC');
$faqData = $collection->getData();
foreach($collection as $faq){
$faq_id = $faq->getId();
$news_data[$faq_id]['id'] = $faq_id;
$news_data[$faq_id]['question'] = $faq->getQuestion();
$news_data[$faq_id]['answer'] = $faq->getAnswer();
}
} catch (NoSuchEntityException $e) {
throw new GraphQlNoSuchEntityException(__($e->getMessage()), $e);
}
return $faqData;
}
How Can i get the actual file path here?