Pictures not displaying in Cloze quiz questions in 1.6

Pictures not displaying in Cloze quiz questions in 1.6

by Paul Simmons -
Number of replies: 5

Pictures are not being displayed in Cloze Quiz questions, instead we only get the file.php link (eg. www.ourmoodle.com/file.php/10/formulappref.jpg.) This problem has only started occuring since upgrading to 1.6 today

Average of ratings: -
In reply to Paul Simmons

Re: Pictures not displaying in Cloze quiz questions in 1.6

by Joseph Rézeau -
Picture of Core developers Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Testers Picture of Translators
Paul,
Is this problem happening in Cloze Quiz questions that you had created under your previous version of Moodle? Have you tried creating new questions under 1.6 to check that pictures are being displayed now?
Joseph
In reply to Joseph Rézeau

Re: Pictures not displaying in Cloze quiz questions in 1.6

by Paul Simmons -

It is occuring in both quizzes from the previous version and new quizzes.

this problem only occurs when putting in pictures using the "image to display" drop down list, pictures appear fine when embedded directly into the question box.

In reply to Paul Simmons

Re: Pictures not displaying in Cloze quiz questions in 1.6

by Joseph Rézeau -
Picture of Core developers Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Testers Picture of Translators
Hi Paul,
Traced the bug, reported it with a solution in bug #5840.
For your information, here is a copy of the bug report:

In all question types it is possible to associate an Image to display (selected from drop-down list in question edit mode).
In Moodle 1.6 b5, this works OK for all question type except the Cloze/Embedded/multianswer question type.
Solution to bug:
in file question/type/multianswer/questiontype.php
// For this question type, we better print the image on top:
around line 200, replace:
echo get_question_image($question, $cmoptions->course);
with
echo ('<img src="'.get_question_image($question, $cmoptions->course).'"/><br>');

Joseph
In reply to Joseph Rézeau

Re: Pictures not displaying in Cloze quiz questions in 1.6

by Paul Simmons -
Thanks, it works, although it now shows a missing picture box (white box with red cross) when a Cloze question does not contain a picture.
In reply to Paul Simmons

Re: Pictures not displaying in Cloze quiz questions in 1.6

by Joseph Rézeau -
Picture of Core developers Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Testers Picture of Translators

Thanks for reporting the bug again! I had forgotten to test the availability of the image. blush

New correction now in bug # 5840:
if ($image = get_question_image($question, $cmoptions->course)) {
    echo ('<img src="'.$image.'"/><br>');
}

Joseph