Dgupta.rspl
Dgupta.rspl

Reputation: 11

how to convert pluginfile image text link moodle?

I am using Moodle version 4.1.1 in which I am using a custom API that I have created. In the custom API, I am getting the question data from the Moodle question table in which there is question text, in the question text there is data in HTML.

In the HTML data, there is an image Tag which is :

"   

"

For the @@PLUGINFILE@@ I have used Moodle function 'file_rewrite_pluginfile_urls' :

file_rewrite_pluginfile_urls($value['questiontext'],'pluginfile.php',$questiondata->contextid,'question','questiontext',$value['id']);

It is genrating the URL:

http://test-lms.ratnasagar.com/pluginfile.php/19699/question/questiontext/220399/apple.jpg

But the actual URL is: http://test-lms.ratnasagar.com/pluginfile.php/19699/question/questiontext/7971/11/220399/apple.jpg

When I am trying to access the link generated by the function "file_rewrite_pluginfile_urls" it shows me the error, please check the below screenshot link for the same.

https://prnt.sc/RvBdmThWHpYi

In the question table in which this question is added, the parent column data is 0. Please check the below screenshot link for the same:

https://prnt.sc/XnKS71OQFwqC https://prnt.sc/3_FL2vOKi0qI

I have used the below function file_rewrite_pluginfile_urls($value['questiontext'],'pluginfile.php',$questiondata->contextid,'question','questiontext',$value['id']);

Also I have checked the URL in which "7971/11" is required but did not get the same how to genrate it.

Upvotes: 1

Views: 231

Answers (0)

Related Questions