Display question text contain image programmatically

Re: Display question text contain image programmatically

by Trần Nam Định -
Number of replies: 0
Hi Tim Hunt!

I do that 

foreach ($questions as $question) {

$questionInstance = question_bank::load_question($question->id);
$quba = question_engine::make_questions_usage_by_activity('qtype_multichoice', $contextId);
$quba->set_preferred_behaviour('adaptive');
$slot = $quba->add_question($questionInstance, $questionInstance->defaultmark);
$quba->start_question($slot);

$response = $questionInstance->get_correct_response();
$response['-submit'] = 1;
$quba->process_action($slot, $response);

$options = new question_display_options();
$options->readonly = true;
$options->flags = question_display_options::HIDDEN;
$options->suppressruntestslink = true;


echo $quba->render_question($slot, $options);
echo "<hr/>";
}

I got image url is "http://localhost/ktqg/pluginfile.php/2/question/questiontext/2aAnyxTdO2/1/5289/iconmultyuser.png"

instate of "http://localhost/ktqg/pluginfile.php/2/question/questiontext/945/1/5289/iconmultyuser.png"

Please help me fix it! :'(

Attachment preview question error.png