Export questions w images - import somewhere else..

Export questions w images - import somewhere else..

ដោយ Melissa Benson នៅ
ចំនួនតប៖ 14

I'd like some clarification on images in quiz questions.

I have a bunch of quiz questions in categories (about 500 questions) that I want to export from Moodle 1.9 and import them into a Moodle 2 site. Some of the questions have images in the question text. I'm assuming the user just uploaded the file in course files or at the time of making the question then just added the image via WYSIWYG.

I exported as Moodle XML then uploaded to a testing site and it worked fine and the images displayed fine.

However, I'm concerned that the link back from Moodle 1.9 to the image will break once that old site isn't used anymore. It looks like it's simply linking to the old site.

If the old site get removed will that link break the image? What's the best way to export the images as well so now they're in my Moodle 2 site? A different export format?

 

Thanks!

មធ្យមភាគនៃរង្វាយតម្លៃ: -
ឆ្លើយតបទៅកាន់ Melissa Benson

Re: Export questions w images - import somewhere else..

ដោយ Pierre Pichet នៅ

"that the link back from Moodle 1.9 to the image"

Did you verify that in all cases your questions ( which questiontypes) contain the old moodle 1,9 link ?

Pierre

មធ្យមភាគនៃរង្វាយតម្លៃ: -
ឆ្លើយតបទៅកាន់ Pierre Pichet

Re: Export questions w images - import somewhere else..

ដោយ Melissa Benson នៅ

They are mostly multiple choice questions..I didn't every single one but I'm assuming they're all pointing to the image which is located on the 1.9 server.

 

I've been doing some research and it looks like exporting questions with images into another site isn't really possible. Because that link will be broken. I've seen discussions where people were talking about using a 3rd party to store images in case this happens....is this true? Again, I want to export questions that contain images and have them come along and import into another Moodle site, and the images don't break when the old site (that originally had the questions) goes away...any help would be great.

មធ្យមភាគនៃរង្វាយតម្លៃ: -
ឆ្លើយតបទៅកាន់ Melissa Benson

Re: Export questions w images - import somewhere else..

ដោយ Pierre Pichet នៅ

I will test something using the restore course procedure and come back let's say tomorrow.

Pierre

 

មធ្យមភាគនៃរង្វាយតម្លៃ: -
ឆ្លើយតបទៅកាន់ Melissa Benson

Re: Export questions w images - import somewhere else..

ដោយ Gary Blackburn នៅ

The Moodle XML sould be exporting the image as base64 which means the image itself will be uploaded into your new version with the  Moodle XML import. I'm not using 1.9 but I know that is how it works in 2.+.

Try opening your exported XML from Moodle 1.9 in a text editor.  If you see something like the XML snippet below associated with a question that contains an image, then your images are being uploaded to your 2.+ server and are not linked to the 1.9 server at all.

<file name="your_image _name.jpg" encoding="base64">/9j/4AAQSkZJRgAB...some long unintelligible text string...ABQAUAFABQAUAFAH/9k=</file> 

មធ្យមភាគនៃរង្វាយតម្លៃ: -
ឆ្លើយតបទៅកាន់ Gary Blackburn

Re: Export questions w images - import somewhere else..

ដោយ Jean-Michel Védrine នៅ

Hello,

I am quite sure Gary that is right and that images are exported as base64 encoded data and not links in the xml file if you use Moodle XML format. And it has been like this for many years.

មធ្យមភាគនៃរង្វាយតម្លៃ: -
ឆ្លើយតបទៅកាន់ Gary Blackburn

Re: Export questions w images - import somewhere else..

ដោយ Melissa Benson នៅ

Yeah, I saw that in the docs but when I went to go check I didn't see anything between the image tags, bot now I do! weird..

 

Okay, so yeah I see the file name and a long long list of random numbers..however when I import it into my new site..and I look at the image, copy the image location it's pointing to the OLD url..so if it's got that link attached the image, which is how it's displaying..won't that link be broken if the old site goes away? It does look like the base64 is in the XML but it's not renaming the URL of the image...

មធ្យមភាគនៃរង្វាយតម្លៃ: -
ឆ្លើយតបទៅកាន់ Melissa Benson

Re: Export questions w images - import somewhere else..

ដោយ Gary Blackburn នៅ

Check the XML <text> element in one of the questions that contain an image. Somewhere in the text you should see an HTML <img> tag. Contained within the the tag is the source location of the image. You should see something that looks like:

src="@ @PLUGIN@ @/your_image_name.jpg"

Basically the @@PLUGINFILE@@ instructs Moodle to store the image (retrieved from the base64) within its own database locate for images. This means that the server location will not point to the old 1.9 sever but rather to a new path that the server will define.

មធ្យមភាគនៃរង្វាយតម្លៃ: -
ឆ្លើយតបទៅកាន់ Gary Blackburn

Re: Export questions w images - import somewhere else..

ដោយ Melissa Benson នៅ

OKAY so I realized that this teacher used images 2 ways 1.) within the "question text" which creates XML like this:

  <question type="multichoice">
    <name><text>1/4w + 4</text>
</name>
    <questiontext format="html">
<text><![CDATA[<img border="0" width="228" vspace="0" hspace="0" height="68" src="http://moodle.bloomington.k12.mn.us/file.php/1/7th_Chapter_9/Screen_shot_2011-10-28_at_12.55.49_PM.png" alt="x" title="x" /><br />]]></text>
    </questiontext>
    <image></image>

and 2.)she used to "image to display" for some which gives me (correct I think) XML code like this:

  <question type="multichoice">
    <name><text>Approximately what is the measure of the hypotenuse of the triangle?</text>
</name>
    <questiontext format="moodle_auto_format">
<text></text>
    </questiontext>
    <image>8th_grade_screen_shots/Screen_shot_2011-11-30_at_11.58.12_AM.png</image>
    <image_base64>
iVBORw0KGgoAAAANSUhEUgAAAb8AAAD6CAIAAAC+k95OAAAV....

 

This is why some of the images, after being imported, linked to the old entire URL - correct?

Now, I'm assuming the correct way is #2 but the thing is that when she did do it correctly with the #2 method the image did not come over! For example, that second set of code is my XML and when I imported it, the image did not show up. Shouldn't it?

So now 2 questions...

  1. Is there a way to get the #1 method images over? I bet not..any tips on getting the image over? Looks like we'll be re-doing those.
  2. Why is the correct method which is generating XML like it should, I think, not sending over the image?

When I look at the question in the new site it puts the image in the "question text" (is there no drop down menu anymore for iamge to dispaly?) but it's a broken image with html like..

 

img src="http://moodlerific.org/moodle1910/draftfile.php/25/user/draft/505344664/8th_grade_screen_shots/Screen_shot_2011-11-30_at_11.58.12_AM.png" alt=""

 

One thing I noticed is that the format in the xml is moodle_autoformat but in the original it looked like HTML format..not sure if that matters.

Version 2.1+ - would upgrading fix it? Thanks!

មធ្យមភាគនៃរង្វាយតម្លៃ: -
ឆ្លើយតបទៅកាន់ Melissa Benson

Re: Export questions w images - import somewhere else..

ដោយ Tim Hunt នៅ
រូបភាព Core developers រូបភាព Documentation writers រូបភាព Particularly helpful Moodlers រូបភាព Peer reviewers រូបភាព Plugin developers

There is no way to get type 1) images transferred from 1.9 -> 2.1 using Moodle XML import/export.

It might be worth trying backup/restore instead.

You are right that the old image to display stuff has been stripped out, however import/export from 1.9 -> 2.x should work.

The Moodle auto-format things was a bug in import in early 2.1.x, but has not been fixed. You really should update to 2.1.4+. There have been many bug-fixes.

មធ្យមភាគនៃរង្វាយតម្លៃ: -
ឆ្លើយតបទៅកាន់ Tim Hunt

Re: Export questions w images - import somewhere else..

ដោយ Pierre Pichet នៅ

"however import/export from 1.9 -> 2.x should work"

I personally think that the Moodle 2 handling of files for ressources is something that is not finished to be optimistic.

I am not sure that even 2,3 goals which are quite mysterious at the time being, will solve correctly all the problems.

However part of the problem could be solved by synchronizing the 1,9 xml export with the specific needs of Moodle 2,0 once things are settled correctly.

Even if this seems bizarre to create a 1,9 bug to solve a 2,0 problem or vice-versa.

Pierre

P.S. Being member of the UQAM Moodle team, the file handling appears to all as the main problem in the migration from 1,9 to 2,x.  

មធ្យមភាគនៃរង្វាយតម្លៃ: -
ឆ្លើយតបទៅកាន់ Pierre Pichet

Re: Export questions w images - import somewhere else..

ដោយ Tim Hunt នៅ
រូបភាព Core developers រូបភាព Documentation writers រូបភាព Particularly helpful Moodlers រូបភាព Peer reviewers រូបភាព Plugin developers

There are three aspects ot the way files are stored.

  1. The acutal way files are stored on disc, with information in the database to link them closely to the content that uses them, is infinitely better than the way it used to work.
  2. The programming API that developers have to use to manipulate files are a bit more fiddly than they could have been. Sadly, it is probably too late to change the API now. As a developer, you just have to work it out.
  3. The user-interface for users managing files is merely OK, and more seriously, is missing some important bits.

The goal for Moodle 2.3 is to tackle problem 3. They are working on the detailed plans of what needs to be done now.

មធ្យមភាគនៃរង្វាយតម្លៃ:Useful (1)
ឆ្លើយតបទៅកាន់ Tim Hunt

Re: Export questions w images - import somewhere else..

ដោយ Pierre Pichet នៅ

Thanks for your ordered response which agree with my own experience.

1. Having a definitive link file-ressouce is very appreciate.

2. Adding images to multichoice answrs or to cloze question, give me the experience to confirm this ញាក់ចិញ្ចើម.

3. The Moodle-UQAM committee can confirm this ញាក់ចិញ្ចើម.

"They are working on the detailed plans of what needs to be done now"

So we are experimenting with less than 5  courses this fall and planning to migrate for fall 2013 just in case that "now" could mean "near future"

Pierre

មធ្យមភាគនៃរង្វាយតម្លៃ: -
ឆ្លើយតបទៅកាន់ Tim Hunt

Re: Export questions w images - import somewhere else..

ដោយ Joseph Rézeau នៅ
រូបភាព Core developers រូបភាព Particularly helpful Moodlers រូបភាព Plugin developers រូបភាព Testers រូបភាព Translators

Tim: "The Moodle auto-format things was a bug in import in early 2.1.x, but has not been fixed."

I expect Tim meant to write "The Moodle auto-format things was a bug in import in early 2.1.x, but has now been fixed."

Joseph

មធ្យមភាគនៃរង្វាយតម្លៃ:Useful (1)
ឆ្លើយតបទៅកាន់ Tim Hunt

Re: Export questions w images - import somewhere else..

ដោយ Jean-Michel Védrine នៅ

My bad, I didn't look at the code before answering so my first answer was not true.

For type 2) backward compatibility is build in Moodle XML import and the old "image to display" is correctly appended to the question text. So when your teachers used that method to add images to questions everything should be fine in Moodle 2.x.

But the situation is not ideal for type 1 images. It should be quite doable to encode images in question text (similar to what is done in Moodle 2.x XML export but with a different code because images are stored in a different way in Moodle 1.9).

Of course XML files encoded in such a way would not import correctly in  Moodle 1.9 but would import all images in Moodle 2.1/2.2.

មធ្យមភាគនៃរង្វាយតម្លៃ: -