General developer forum

question images

 
Picture of santhosh kumar
question images
 

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: -
Tim at Lone Pine Koala Sanctuary
Re: question images
Core developersDocumentation writersParticularly helpful MoodlersPlugin 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


 
Average of ratings: -
Picture of santhosh kumar
Re: question images
 
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


 
Average of ratings: -
Picture of santhosh kumar
Re: question images
 

thanks Tim

 
Average of ratings: -