Gift with medias format

Jump to: navigation, search

Gift with medias is a Moodle plugin that allows to import questions written with the same syntax used by the GIFT format, but instead of a text file it imports a zip file containing the gift text file and media files (images, sounds, ...);.


This is a contributed plugin, so must be installed separately to Moodle and is available in the Moodle Plugins Directory at GIFT with media import format.

One way to understand how to prepare your questions to be imported using this format is to look at the included sample file that you will find in question/format/giftmedia/ This is zip archive so if you open it you will find

  • A text file named giftmediaexample.txt written using the GIFT syntax
  • An images subfolder with 4 images: 93px-Zuckermann_ZBox_harpsichord.JPG, 99px-SMV_organ.jpg, 120px-MIM_Clavichord_CN344.jpg and 120px-Perzina_pianos.JPG
  • A sounds subfolder with only one file piano.mp3 (please note that in a real question for students this would be a bad name as it would give a clue to the correct answer !)

The content of the giftmediaexample.txt file is

//This is a simple MC question linked to a single MP3 file which is included in the archive. 
::MC question with images and an MP3 file::
Listen to this<a href\="@@PLUGINFILE@@/sounds/piano.mp3">:</a><br>
What is it?
{=<img style\="vertical-align: middle; margin: 10px;" src\="@@PLUGINFILE@@/images/120px-Perzina_pianos.JPG" alt\="a piano" />a piano
~<img style\="vertical-align: middle; margin: 10px;" src\="@@PLUGINFILE@@/images/93px-Zuckermann_ZBox_harpsichord.JPG" alt\="a harpsichord" />a harpsichord
~<img style\="vertical-align: middle; margin: 10px;" src\="@@PLUGINFILE@@/images/99px-SMV_organ.jpg" alt\="an organ" />an organ
~<img style\="vertical-align: middle; margin: 10px;" src\="@@PLUGINFILE@@/images/120px-MIM_Clavichord_CN344.jpg" alt\="a clavichord" />a clavichord}

You can recognize a question using the GIFT syntax, and see how the sound file and the images are included : the special word @@PLUGINFILE@@ is added at the begining of the path to the file.

If you import this zip archive into the question bank (this also works for a Lesson) you will get a multichoice question that will display as:


As you see the link to the sound file has been replaced by a media player and the images are displayed.


Currently the text file containing the questions must be at the root level of the zip archive, and it must have a .txt extension to be correctly found and parsed.

Don't forget that in the GIFT syntax the `=` character is a special character, so each `=` in your HTML has to be written as `\=` (see example above). It is very easy to make this mistake and then wonder why no questions are imported, so you have been warned.

Don't forget also that your GIFT text file must must be correctly encoded in UTF-8