Images not displayed in quizzes but are elsewhere else

Images not displayed in quizzes but are elsewhere else

by Steve Hegwood -
Number of replies: 12

I have searched for hours over the past several day and can not find an solution or mention of my problems.

I am inserting (or at least trying to) images into multiple choice quizzes. I have done so using the "insert image" button, typing the link code directly, and by using the "Image to Display" dropdown. I have the same results every time. The image files, uploaded to the course files, are not being displayed and all I get is the red x and the alt text for the image. When navigating to the images and clicking on them using the course files link they open as ASCII gibberish.

The image files (gif and jpg) are viewable if I move them back to my local desktop and when using my hosts viewer, so I do not believe that the files are corrupted.

To further test the image files, I have tried linking to the gif that I am using as my correctly displayed moodle site logo and that image file is also unviewable in the course file list and in the quiz.

I am just getting started with Moodle and any help would be greatly appreciated.

I am using version 1.9 on HostMonster.

Average of ratings: -
In reply to Steve Hegwood

Re: Images not displayed in quizzes but are everywhere else

by Steve Hegwood -

Almost 24 hours later with no replies and I got a little impatient - reinstalled everything. Still having the same problem. Images files (gif and jpg) are not being displayed in quizzes but are working just fine in my chosen theme. When accessed through the course files link I get nothing but a screen filled ASCII gibberish.

I have also tried adding images in other activities and I'm seeing the same problem, so this is not exclusive to the quizzes as I first thought.

Thanks

In reply to Steve Hegwood

Re: Images not displayed in quizzes but are everywhere else

by Tim Hunt -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers
"When accessed through the course files link I get nothing but a screen filled ASCII gibberish."

This will be the problem then, so it is not a quiz-specific problem. You may have a greater chance of finding someone who knows in the General problems, or installation forums.

(Have you got any extra whitespace at the end of config.php, that might cause this.)
In reply to Tim Hunt

Re: Images not displayed in quizzes but are everywhere else

by Steve Hegwood -

config.php appears to be ok.

I'll probe out in the General Problems forum. Thanks.

In reply to Steve Hegwood

Re: Images not displayed in quizzes but are everywhere else

by dermot oreilly -
Funnily enough I has this issue as well with Moodle version 1.9.2. After installing the 'image target' question module I could not get the required image to display- the only thing displayed was the placeholder. After hours of trying to figure out a solution I uninstalled 1.9.2 and installed 1.9.1 instead (with identical settings). This solved the problem - but I am unsure as to the reason! There must be some issue with 1.9.2 and images...
In reply to dermot oreilly

Re: Images not displayed in quizzes but are everywhere else

by Clemens Niederholtmeyer -
I had a similar issue. After installing Moodle version 1.9.2 the images in my MC-questions were not displayed.
Two hacks solved my problem.
in lib/questionlib.php:
function get_question_image($question)
-> function get_question_image($question, $courseid)

and in question/type/multichoice/questiontype.php , line 274:
$image = get_question_image($question);
-> $image = get_question_image($question, $cmoptions->course);

But, i do not know if there some other effects.
In reply to dermot oreilly

Re: Images not displayed in quizzes but are everywhere else

by Nathan Hammond -
I have the same problem. Running 1.9.2 and can't get the image to display. I'm running PHP 5.1.6

Are there any solutions (besides going back to 1.9.1)

Nathan
In reply to Nathan Hammond

Re: Images not displayed in quizzes but are everywhere else

by Tim Hunt -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers
Unfortunately there was a bug with question images that got into the Moodle 1.9.2 release. It was fixed pretty quickly, so you need to update to 1.9.2+, or at least apply the fix from MDL-15792 - that is http://cvs.moodle.org/moodle/lib/questionlib.php?r1=1.119.2.14&r2=1.119.2.15
In reply to Tim Hunt

Re: Images not displayed in quizzes but are everywhere else

by Nathan Hammond -
Thank you so much Tim for the very speedy reply. Great info.

About upgrading between version 1.92 and 1.92+ (or latest build). Is there another way to do it or should I follow the upgrade instructions in moodle docs (http://docs.moodle.org/en/Upgrading_Moodle#Using_a_downloaded_archive)

Nathan
In reply to Nathan Hammond

Re: Images not displayed in quizzes but are everywhere else

by Tim Hunt -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers
Those instructions should be right! Well, you don't need to use precisely those commands, but those are the basic steps that need to be done. Do not ignore the bit about backing everything up first.
In reply to Steve Hegwood

Re: Images not displayed in quizzes but are elsewhere else

by Rockie Moodle -
How to put images in the Answers of MCQ questions.
  1. upload the necessary image files to your course files
  2. create a multiple choice question
  3. in the Feedback field for Answer 1, click on the Insert Image button of the HTML editor
  4. go to the File browser and select the image you want to use for Answer 1
  5. when image has been inserted into Answer 1 Feedback field, click on Toggle HTML source button
  6. select and copy the code, something like: <img width="44" vspace="0" hspace="0" height="33" border="0" src="http://moodle/file.php/4/image1.jpg" />
  7. now paste that code into the Answer 1 "answer" field
  8. if you no longer need the image in the Feedback field, delete it
  9. repeat steps 3 through 8 for each Choice Answer where you need an image.
This is a rather boring manipulation, but it is guaranteed to work, see attached screen shot.


image00.jpg


Regards,
Rockie
In reply to Rockie Moodle

Re: Images not displayed in quizzes but are elsewhere else

by Joseph Rézeau -
Picture of Core developers Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Testers Picture of Translators
Credits to Joseph Rézeau.wink
In reply to Joseph Rézeau

Re: Images not displayed in quizzes but are elsewhere else

by Sanjay P. K. -
I am using Moodle 1.9.1. I tried to insert images into some multiple choice questions ( not in the answer field) in a quiz. The images are from a sub folder of the course files folder. I inserted them in the question using the "insert Image" from the WYSIWYG editor; I could see the image in the question field and was able to scale it as well. The "Image to Display" drop down below the question field remains "None". I can see the image when I look at the preview of the question . When I take a preview of the quiz containing this question, I do not see the image and instead only the "Alternate text" (given while selecting the image using "insert Image" ) is displayed ( not as a hyperlink). When these images were inserted to a Short Anser question (using the "insert Image"), theywere displyed propely in quiz preview. When the image was inserted (into the multiple choice question ) using the "Image to Display" drop down, they were displyed propely in quiz preview. The probelm in this case was that I was not able to scale the image. Any suggestions?