The Question of Missing Images


Getting images into questions remains the last stumbling block.

Solving the question import process was awesome but automatically importing images into those questions still remains the last unmet challenge. Images are either simply broken or have unwanted hard coded links back to the Canvas instance.

Solution dead-ends

For example, one Chemistry exam had 60 questions with 127 images. It’s pedagogically critical that not one is missed or incorrect. At least the Canvas export files provide the original image files – and even generates the images for LaTeX.

Any solution had to be kept to existing tool base – scripting new tools was out of scope. So a limited amount of time was spent investigating tech-type tricks:

  • Following tips like this: https://www.slideshare.net/tjuly/adding-images-to-moodle-quiz-and-import-via-xml
  • Like Moodle Books, compress both the quiz xml and images together
  • Uploading images to the course and trying to create links
  • Creating image in one questions, removing the path information from the image filename, seeing if the images would load in subsequent questions.
  • Hacking the Moodle XML to preload all images in various tag elements.

All these explorations ended in dead-ends.

Solutions (plural)

The first two methods are suitable for a small number of images or very simple questions (or if people are uncomfortable hacking XML).

Manually update – method 1

For images in questions that display as a broken file, the only method practical method is to reload (although I’m happy to be proved wrong):

  • Open each question in Moodle
  • Double click each missing image
  • Remember the image attributes
  • Loading the replacement file found in the unzipped QTI file.
  • Reapply the original image attributes
  • Save the changes

Manual update – method 2

Sometimes question images actually appear but if you look at the HTML source code, you can see they are hosted in Canvas. The second method is essentially the same as method 1, but instead of tediously searching for the file, the previewed file is right-click -> Save Image As… and saved to the downloads folder. Then it’s Browse repostiories… and reinserted in the uniquely Moodle way.

XML hacking

The first two methods have two big issues:

  • the tedious nature of using the Moodle UI
  • the risk of missing images in answers, distractors and feedback fields makes it an even slower process.

The third method involves hacking the Moodle XML. After ingesting the Canvas QTI file, I re-export the sames questions as Moodle XML. In the gallery below, you can see the process to create image using XML:

Process for hacking the Moodle XML: replacing missing image with a base64 encoded version.(edit gallery)

This approach allowed me to use a more methodical approach, working top to bottom of a big question bank file. RegEx find and replace also greatly reduced the effort required.

I badly want this xml hacking scripted.

Quality Control

Each finished Quiz file was exported to a Moodle XML file. The code was searched for any image source references to either (a) Canvas or (b) is without the @@PLUGINIMAGE@@ flag in the XML. Any occurance, the fix is pretty simple – unless the image was missing in Canvas subject itself!

Tools used

Conclusion

It’s up to the developer to pick the method that works for the the situation.

This sort of task is ideal for scripting or for extending the original Canvas QTI import plug-in. Unfortunately this was out of scope given budget, deadlines and availability of people who can script.




Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.