Problem with missing images in quiz after 1.9.x upgrade to 2.2.x

Problem with missing images in quiz after 1.9.x upgrade to 2.2.x

by John Reese -
Number of replies: 12

Just a general question. Have anyone of you experience this situation where after you upgraded your 1.9.x instance to at least 2.2.x, the images in the quiz are missing?

We upgraded from 1.9.14+ to 2.2.4 (July 17, 2012 build)

“It has recently come to our attention that since the upgrade to MOODLE 2, all of our quiz question image files are no longer being displayed. It appears that the links to the image files are now all broken. As all of our new courses are using MOODLE for assessments and grading it is imperative that we get this problem fixed as soon as possible.”

“I have tried re-stamping with no success. The only way I have found that would work was to re-upload the single file and add it in to the quiz. I have also noticed there are no bulk file upload features enabled in our instance moodle, so this process will be incredibly laborious as each course has approximately 70 image files that need to be re-uploaded and re-linked. I have also noticed that legacy file support has been disabled for new courses (this is the default setting, and if probably a good choice as it breaks other functionality). I noticed that in one of my master courses the legacy files are present, because the course existed prior to the upgrade. The master course displays the image files properly within the quizzes.”

Perhaps turning the legacy file option may fix it as a workaround.

I told my users that Moodle 1.9.x and Moodle 2.x manage files and images in a totally different way.

How could I resolve this?

Average of ratings: Useful (1)
In reply to John Reese

Re: Problem with missing images in quiz after 1.9.x upgrade to 2.2.x

by Chris Adams -

Yes, we're having almighty problems with this too and really could do with a fix. There is a partial fix at MDL-33424, but that only fixes the images in the question text (not the answers). There also appears to be an issue with the way the backup is performed - it seems that the images work better if the restore is done as a new course rather than being merged into an existing course.

Average of ratings: Useful (1)
In reply to John Reese

Re: Problem with missing images in quiz after 1.9.x upgrade to 2.2.x

by Emma Richardson -
Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Plugin developers

Yes, I had the same issue.  Took me close to a week to go through a few hundred questions and reattach all the pictures. I was hoping they had fixed it since then but maybe not.

In reply to Emma Richardson

Re: Problem with missing images in quiz after 1.9.x upgrade to 2.2.x

by John Reese -

Chris and Emma,

Did you upgrade from 1.9 to 2.0 then from 2.0 to 2.1 and then to 2.2?

or did you upgrade directly to 1.9.x to 2.2.x?

In reply to John Reese

Re: Problem with missing images in quiz after 1.9.x upgrade to 2.2.x

by Emma Richardson -
Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Plugin developers

I went from 1.9 to 2.0 and then to 2.2 and then 2.3.  My quizzes were originally in Hot Potatoes which was not available in 2.0 when it first came out.  So I converted all my hot potatoes to the new quiz format.  That is when I lost the images - you guys are correct - it is because of the new file structure. Moodle 2.0 totally changed the file structure and the quizzes were looking for the pictures in the old location.  I never was able to find a way around it so I reuploaded all of the pictures.  However, that was when 2.0 first came out - it seems like the quiz upgrade should be working better now??  But maybe that is still an issue.  If you keep them in the Legacy area, I think you will have issues with permissions when you restore the course to a new instance.  In the long run you are better off getting them in the right place.  

Average of ratings: Useful (1)
In reply to John Reese

Re: Problem with missing images in quiz after 1.9.x upgrade to 2.2.x

by John Reese -

I believe I have figured it out … I now think it has something to do with legacy file structure… when we look at the url of the image in your quiz it’s using the old moodle 1.9.x legacy file system.

Something like:

http://ourmoodle.site.com/file.php/2442/ppg/Block_G/f1q3g1.jpg

In moodle 2.2.x, I created a new quiz and inserted an image in the quiz (questiontext field), and the url is totally different…

http://ourmoodle.site.com/pluginfile.php/149530/question/questiontext/270754/1/836047/dkrises.jpg

How to solve this, I have no idea… you may just have to upload and redo the images… even when I try to edit my test image in code view, the url is changed to:

http://ourmoodle.site.com/draftfile.php/46910/user/draft/909529315/dkrises.jpg

Another reason why it’s the legacy file support is the cause is that on one of our server, the legacy file is turned on (no problem) whereas our production one, is turned off.

I am wondering if there would be any problems caused by re-enabling the legacy course file repository?

 

In reply to John Reese

Re: Problem with missing images in quiz after 1.9.x upgrade to 2.2.x

by John Reese -

Maybe we should just turn it back on

Note: This page only applies to sites which have been upgraded from Moodle 1.9.

http://docs.moodle.org/23/en/Legacy_course_files#In_backups.2C_are_legacy_files_included_with_a_course.3F

In reply to John Reese

Re: Problem with missing images in quiz after 1.9.x upgrade to 2.2.x

by John Reese -

Turning them (legacy file repository) back on made no difference sad

Images still not showing up in quizzes... one was 2.2.3+ (had the images) and other was 2.2.4+ (which did not work)

sigh ...

 

In reply to John Reese

Re: Problem with missing images in quiz after 1.9.x upgrade to 2.2.x

by Chris Adams -

We've got a clean install of 2.3. The patch I linked to above partly solves the problem, but only for question text, not the answers. We added the following to the patch:

$this->fileman->filearea  = 'generalfeedback';

$data['generalfeedback'] = moodle1_converter::migrate_referenced_files($data['generalfeedback'], $this->fileman);

which partly solves the problem, but only if the quiz is restored as a part of a new course. If you merge it into an existing course in 2.3, the images still don't come.

 

In reply to Chris Adams

Re: Problem with missing images in quiz after 1.9.x upgrade to 2.2.x

by John Reese -

Hi Chris,

Unfortunately, made no difference .. these patches don't work on existing quizzes already in our 2.2.4+.

This may work when we restore from a 1.9.x INTO 2.2.x though but not like our situation.

In reply to John Reese

Re: Problem with missing images in quiz after 1.9.x upgrade to 2.2.x

by John Reese -

Found a workaround.

Zip up the image files from our 1.9.14+ or backup instance of moodle

upload zip file to legacy file area

unzip it there

now images show up =)

In reply to John Reese

Re: Problem with missing images in quiz after 1.9.x upgrade to 2.2.x

by Monika Bonaldo -

How will this work for someone that is creating a new version of the course monthly? Each time the course is copied out we would need to do this or is this a one time thing? I'm on 2.4.

In reply to Monika Bonaldo

Re: Problem with missing images in quiz after 1.9.x upgrade to 2.2.x

by Andre Cunha -
Try use yourserver.com/admin/tool/replace/index.php