question images

question images

by santhosh kumar -
Number of replies: 3

Hi all


I have inserted images in question. I want image fullpath in to show image in my custom page. this is the path "http://localhost/moodle/pluginfile.php/21/question/questiontext/2/3/3/kkkkkkk.gif". can some one describe how can i get i value of numeric value path.

21--- contextid

2-----??(what is this and how can i get)

3----??(what is this and how can i get)

3--- itemid(Questionid)






Average of ratings: -
In reply to santhosh kumar

Re: question images

by Tim Hunt -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers

That is not how uploaded files work in Moodle.

You really need to understand https://docs.moodle.org/dev/File_API.

If you want a short answer, see if you can work out how these to bits of code work together in the statistics report:

https://github.com/moodle/moodle/blob/master/mod/quiz/report/statistics/report.php#L348

https://github.com/moodle/moodle/blob/master/mod/quiz/report/statistics/lib.php#L27


In reply to Tim Hunt

Re: question images

by santhosh kumar -
Tim thank for reply.

I read the both url and a lot of article too. But i could not understand that how can get path for Question image display for user.
I can create path of  question image in preview through admin. My question type is multiple question type.

http://localhost/moodle/pluginfile.php/21(contexid)/question/questiontext/2(?)/3(?)/3(questionid)/kkkkkkk.gif

https://github.com/moodle/moodle/blob/master/question/type/questiontypebase.php#L1131
https://github.com/moodle/moodle/blob/master/question/format/xml/format.php?utf8=%E2%9C%93#L238
https://github.com/moodle/moodle/blob/master/mod/quiz/report/statistics/lib.php#L27
https://github.com/moodle/moodle/blob/master/mod/quiz/report/statistics/report.php#L348
https://docs.moodle.org/dev/File_API
can some one please simplifies the url.

 
Regards,
Santosh