Quiz

 
 
Picture of Nick Schroeder
Pictures Not Displaying
 

Greetings everyone,

 

I’m fairly new to Moodle and I need some help troubleshooting/fixing an issue with pictures not showing up for quizzes.  When I edit a question and post I picture, I can see it in the edit box

 

However, when I save the question and click “preview question” box, it doesn’t show up.  The same is true when I attempt the actual quiz.

 

It doesn’t matter if it’s a picture on the server, or if it’s a URL.  It will not display the picture. 

 

Environment:

Windows Server 2008 R2

MSSQL 2005

IIS7

 

We just upgraded from Moodle 2.2.3 to Moodle 2.5.0 and we had this issue prior to the upgrade.

 
Average of ratings: -
Picture of Emma Richardson
Re: Pictures Not Displaying
Group Particularly helpful Moodlers

How are you adding the pictures to the quizzes?  Where are the pictures stored? Have you checked permissions?

 
Average of ratings: -
Picture of Nick Schroeder
Re: Pictures Not Displaying
 

How are you adding the pictures to the quizzes?  

1.)   I edit the quiz and I click on the “Edit Question”. 

2.)   In the Question Text box I click “Insert/Edit Image”. 

3.)   Next, I click on “Find or upload an image”.

4.)   This launches “File Picker”.  I click on “Upload a file”, select my file, fill out the “Save as” and click Upload. (Note* besides uploading a file, I’ve tried using a server file and I’ve tried putting the just the URL of the picture.

5.)   The picture displays fine in the preview window, so I give it an image description and click “insert”.

6.)   Back at the “Editing a Multiple Choice Question, the image is displaying perfectly under the “Question Text” box.  And I click “Save changes”.

 EditBox

 

However, when I click the preview question icon, I get the following:

 

 Preview Question

Where are the pictures stored?  

Are you asking about where the pictures are stored on the server? Or where are they stored in Moodle?

 

Have you checked permissions?

I have full admin rights to the entire Moodle site.

 
Average of ratings: -
Picture of Jean-Michel Védrine
Re: Pictures Not Displaying
Group DevelopersGroup Particularly helpful Moodlers

Hello,

thanks for giving us a detailed answer I hope it will permit us to help you. Your step seems quite correct to me but I see 2 possible way the image could be missing.

First test

Do exactly the same thing just changing 2 things (I know it may seems strange smile)

  1. Don't fill out the “Save as”, click directly on "Upload this file"
  2. Don't give it an "image description", click directly on "Insert" you will see a dialogue "Are you sure you want to continue without including an image description? Without it the image may not be accessible to some users with disabilities, or to those using a text browser, or browsing the Web with images " just click on "yes"

And tell us if it makes a difference and if the image is now visible.

Second test

Return on the page with the missing image (the one corresponding to your last screenshot and display the source code of the page (with my browser Firefox to do that I right click on the page (but not on an image or a link) and choose "View Page Source" in the menu) copy the entire source code of the page, paste it in a text file and post it here so that I can see the html code generated for the image and try to guess what the problem is.

 

 
Average of ratings: -
Picture of Nick Schroeder
Re: Pictures Not Displaying
 

First Test

I tried to upload the file without filling in “Save as” and I didn’t give it an “Image Description”. It still doesn’t display the image.

 

Second Test:

Attached

 

 
Average of ratings: -
Picture of Jean-Michel Védrine
Re: Pictures Not Displaying
Group DevelopersGroup Particularly helpful Moodlers

The html code for the image is completely broken:

 <img src=
  "<img class="filter_urltolink_image" alt="" src="http://moodle.jcisd.org/pluginfile.php/9531/question/questiontext/9252/1/68724/stonehenge-iphone.jpg" />"
  alt="" width="320" height="257" />

and it should be:

 <img src="http://moodle.jcisd.org/pluginfile.php/9531/question/questiontext/9252/1/68724/stonehenge-iphone.jpg"  alt="" width="320" height="257" />

So it seems to me that you have a wrong settings in the urltolink filter

Go to site administration -> Plugins -> Filters -> Convert URLs into links and images

and change back the settings to the default ones. Or even better deactivate this filter as I think that most Moodle users don't use Moodle auto-format so they don't need it.

I think this should solve the problemurltolink filter settings

 
Average of ratings: -
Tim at Lone Pine Koala Sanctuary
Re: Pictures Not Displaying
Group DevelopersGroup Documentation writersGroup Particularly helpful Moodlers

The URL auto-linking filter should be intelligent enough to not try to process a URL that is preceeded by src="

And there are some unit tests that should verify that: https://github.com/moodle/moodle/blob/master/filter/urltolink/tests/filter_test.php#L139

I wonder why it is breaking for you?

 
Average of ratings: -