Students Cannot See Images in Quizzes

Students Cannot See Images in Quizzes

by Beau Sanders -
Number of replies: 10

RE:  Installed Build: Moodle 1.9.7+ (Build: 20091223)

Greetings from South Carolina!

During the Christmas Break I updated my moodle server to the then current version as I regularly do between semesters. I then restored current backups of courses to create new sections for the classes I teach. I tested the new installs/classes using the "Student" mode feature and the quizzes appeared with images.

Today an excellent student calls me in a panic and says that he cannot see the images in a test/quiz he was taking. He tried several computers and several browsers, all with the same issue...the dreaded "box with a red x" where the image is supposed to be.

I immediately started testing on my end. Both the administrator and the "Student" mode user could see the images fine. Then I created a test student, added them to the class, and took the quiz. My test student worked fine...I thought.

Next I logged in as the test student on a different computer, my notebook, and the quiz images were gone again.

About this time the excellent student walks into my office wanting to know if I had fixed the problem. I said..."not really". I had him log in on my office computer and yes indeed, the images appearred. Then we walked down the hall to a classroom, logged in, and tried to really take the test...nope...no images.

Something very strange is going on with the quiz images. The problem depends on the local computer configuration...in my opinion. I have the latest version of Java Runtime installed (1.6) installed in Windows XP SP3. That may not be the problem, because on my notebook computer running Windows 7 Professional with Java Runtime (1.6) installed...the images do not display in quizzes.

Short of rewriting all my quiz questions in html with an absolute path to the images in a folder under the doucment root (which works by the way), can someone tell me how to correct this issue within moodle and its security and scripting framework.

Thank you in advance for your help on this issue. I am going to post this issue in both "General Problems" and "Quiz Module" with hopes of getting a fast resolution.

-Beau

Average of ratings: -
In reply to Beau Sanders

Re: Students Cannot See Images in Quizzes

by Daniel McCloy -
I have dealt with this very issue last month. Here is what is happening: the images are apparently stored in a place that the students don't have permission to access. When you visit the quiz it loads the images because you are an administrator. Now the images are in your browser cache... even if you log out and log back in with a student-only account, the images will be in the cache and will load properly because moodle doesn't get involved in the image serving, they come straight from the cache on the local hard disk. If you clear the cache, switch to another browser, or switch to another machine, the student account no longer can see the images.

We solved this problem by creating a fake course within the same category and stored all our images there. Then we hacked the permission structure of that course so that one of its properties was that every single user automatically had student-level permissions in it. Thus questions in other legitimate courses could call images from URLs within the fake course, and they would display normally. Not an elegant or ideal solution but it worked in the short term; it was quite a bit of work, however, to go in and change the image links in every single question. (Maybe if you could backup the questions and write a script to change URLs in the XML for you, then restore the changed XML, that might be more efficient.)

(note that we arrived at this problem because we moved all our questions up to the category level in order to share them between courses, but the moodle-internal tool for moving questions around choked on every question that had an image in it, saying "cannot write to destination context" or something like that. In other words, it wouldn't allow us to host images at the category level, only at the course level; hence the solution to host them in a fake course. This has been reported as a bug and will allegedly be fixed w/ 2.0.)
Average of ratings: Useful (2)
In reply to Daniel McCloy

Re: Students Cannot See Images in Quizzes

by Beau Sanders -

Daniel, thanks so much for your input.

This seems to be a serious bug. What would happen if an administrator wanted to create multiple copies of a course for several teachers. This happens all the time at our school. It seems to me that this bug would keep us from successfully copying courses.

I corrected this problem in another course much like you did. I created a directory under document root. Next I copied all of the course quiz images into that directory. Then, the hard part, I edited the html code for each question with an image to point to the new directory for its image rather than using the "private" directory moodle creates behind the document root.

I like moodle's idea of protecting quizzes behind/below the document root of the moodle server, but it is creating problems.

Another issue might be part of this; I had added a certificate to this server and use port 443 to access my moodle server to encrypt commuinications. In theory that should not make a difference, but it could if the moodle software does not take SSL into consideration.

Unless I see something today in this forum, I will be forced to spend the afternoon recoding hundreds of quiz questions.

Thanks again for your post, Daniel.

-Beau

In reply to Beau Sanders

Re: Students Cannot See Images in Quizzes

by Daniel McCloy -
In fact the bug is not as serious as you imagine. Where the bug really matters is when you want to move questions w/ images from the COURSE level to the CATEGORY level. Copying a question w/ image from one course to another course seems to work, and moodle seems to do an adequate job moving the files and updating the links, as long as (1) it's an image, and (2) it was added through the moodle "insert image" interface, and (3) the image is in the question text, not in the answer choices. We've had mixed results when we hand-write any URLs into the question HTML (moodle is sometimes unaware of them and will not copy the associated files nor change their links) or when embedding audio clips into the questions (moodle simply doesn't know they're present and treats them as questions with no associated media files).


Average of ratings: Useful (1)
In reply to Daniel McCloy

Re: Students Cannot See Images in Quizzes

by Beau Sanders -

Daniel, thank you again for your help.

After experimenting with this issue for a while, it appears to me that the issue stems from an import plugin that I used to move the questions I developed using Respondus into Moodle. The import worked in the first course, but when I copied that course to a new course, something went wrong with the images in the quizzes.

I have followed your advice to start correcting this problem. It is going to take many hours to resolve:

  1. Created directories under Course ID 1 for the problem courses and transferred the quiz images using FTP
  2. Edited the quiz questions that contained images using the moodle "Insert Image" tool/wizard
  3. Cleared my browser cache pressing Shift-F5 and the utility CCleaner (free download)
  4. Logged in as a test student and opened the quiz; all images appeared
  5. Next I copied the whole course to a new course using moodle's backup and restore features
  6. After enrolling my test student in the new course, once again I cleared my cache and logged in; the images appeared successfully
  7. I also tested this in Firefox as well as Internet Explorer

Conclusions:

  1. There may be something magic about Course ID 1, it does not seem to have any problems
  2. The one course where I entered the questions directly in moodle seems to work without any of these issues; thank goodness because that course has the most class sections and gets copied several times a semester

Here are some links that I used to learn how to import from Respondus into moodle: 

http://moodle.org/mod/forum/discuss.php?d=91742

http://www.respondus.com/update/2007-11-c.shtml

The posts above are citing newer versions of the import plugin, so I hope the issue I have been experiencing is fixed. For those of you importing from Respondus, be sure to copy a course and and look at the quiz images as before assuming the images will appear in the copy of your course.

-Beau

In reply to Beau Sanders

Re: Students Cannot See Images in Quizzes

by Mary Cooch -
Picture of Documentation writers Picture of Moodle HQ Picture of Particularly helpful Moodlers Picture of Testers Picture of Translators
"course ID 1" as you call it, is the site files of Moodle and as such potentially publicly visible to the world (if they know or can guess the url) Quiz images from there will probably appear without any problems as there is no need to be enrolled in any course/be behind an enrolment key in order to view them.
In reply to Mary Cooch

Re: Students Cannot See Images in Quizzes

by Beau Sanders -

Mary, thanks for replying.

In my installation I am referring to /serverroot/moodledata/1/ when I said Course ID 1. Everytime I create a course, a new directory is created for its files under moodledata.

It was suggested during installation that moodledata should be located outside the document root for the server; on my server this is /serverroot/www/moodle/. I am sure there are ways to hack in, but they would not find too much once they get there.

-Beau

In reply to Beau Sanders

Re: Students Cannot See Images in Quizzes

by Daniel McCloy -
Thanks for the update. FYI, our long-term strategy (to be implemented at the next term break) is to move all media to a separate server where moodle permissions are not an issue. Images & audio clips will then be embedded in moodle questions using hand-written HTML instead of the moodle "insert image" interface. That way, no matter where the courses or questions get moved or copied, the images will always display, independent of any issues of moodle permissions.
In reply to Daniel McCloy

Re: Students Cannot See Images in Quizzes

by Beau Sanders -

That seems like a drastic step to take just to get moodle permissions to cooperate. It seems like the moodle guys should be able to fix this problem or give us some guidance on how to work around the issue. There are a number of posts dealing with similar issues to ours.

-Beau

In reply to Beau Sanders

Re: Students Cannot See Images in Quizzes

by Jaime McLeod -

We are having the same issue at my school. The quiz image locations seem to be linked to the old location. When you copy courses from semester to semester, it moves the quiz images over; however, in the quizzes it still points to the images in the older course. The students are not registered for the other course, so they cannot see the image.

One work around is to put the quiz images on a web server, but I wish Moodle would automically change the location of the images inside the quizzes. As far as I can see, it does not.

In reply to Jaime McLeod

Re: Students Cannot See Images in Quizzes

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

The new file handling in Moodle 2.0 deals with this issue once and for all.