Lesson does not display images

Lesson does not display images

by Swapna Lonkar -
Number of replies: 7

Hi,

I am new to moodle. I am trying to use the lesson feature of moodle in my course. After successful creation of a lesson i select Add a Branch Table option and insert an image in Page contents section using the Insert image tool. After adding a navigation for next and previous page, i select the Save page button. The image is visible in the Page contents section during editing of the branch table. However, while viewing this page of the lesson the image is not displayed.  I verified that the image is present in the lesson subdirectory. An error is reported in apache error.log file.

Inserting an image in topic mode works just fine, but not in lesson mode.

The details of the environment i am using are :

Platform : Windows XP - SP3

Browser : IE7

Moodle : Version 1.9.7+ (Build 20091223)

I went through the html code generated for displaying the lesson and found that the html code for <img src> that is used to display the image had extra quotes. So, i modified the "img src" section manually outside of moodle. On loading the new html page in browser, the image was correctly displayed.

Find attached 

apache error log :

[Tue Feb 16 13:31:38 2010] [error] [client 127.0.0.1] (20024)The given path is misformatted or contained invalid characters: Cannot map GET /mod/lesson/%3Ca%20href= HTTP/1.1 to file, referer: http://127.0.0.1/mod/lesson/edit.php?id=261
[Tue Feb 16 13:32:50 2010] [error] [client 127.0.0.1] (20024)The given path is misformatted or contained invalid characters: Cannot map GET /mod/lesson/%3Ca%20href= HTTP/1.1 to file, referer: http://127.0.0.1/mod/lesson/edit.php?id=261
[Tue Feb 16 13:35:01 2010] [error] [client 127.0.0.1] (20024)The given path is misformatted or contained invalid characters: Cannot map GET /mod/lesson/%3Ca%20href= HTTP/1.1 to file, referer: http://127.0.0.1/mod/lesson/view.php?id=261

Find attached  modified view output html source (look at the highlighted section in the code).

Do any of you have a suggestion on how i can get this to work? Please help. Thanx.

- Swapna 

Average of ratings: -
In reply to Swapna Lonkar

Re: Lesson does not display images

by Chris Collman -
Picture of Documentation writers
Hi Swapna,
Interesting post with lots of information.

I did not understand what you mean by a "topic mode" . I think you mean you inserted an image like diagram1.jpg in a topic section description and it displayed. Is this correct? Also did you try to display diagram1.jpg in a net HTML block? I am guessing it will display but....

I am not the brightest lightbulb in the pack when it comes to code, I like to answer the easy questions smile

Thanks for your post which led me back to demo.moodle.org and a discovery that the two Lessons there have some issues. Time for me to quality control them to see how many dead image paths, expired "deadlines" and other things I can find that were not intended. smile

Chris



In reply to Chris Collman

Re: Lesson does not display images

by Swapna Lonkar -

Hi Chris,

I did not understand what you mean by a "topic mode" . I think you mean you inserted an image like diagram1.jpg in a topic section description and it displayed.  Is this correct?

That's right. That is exactly what i did. And the image is displayed.

Also did you try to display diagram1.jpg in a net HTML block? I am  guessing it will display but....

Sorry, I haven't used this feature as yet.

Thanks for your post which led me back to demo.moodle.org and a discovery that the two Lessons there have some issues.

I did look at the demo and seems like the image is not displayed there either.

 Time for me to quality control them to see how many dead image paths, expired "deadlines" and other things I can find that were not intended. 

Should i consider this as a bug. If so, any idea when it will be fixed. I need to demo this feature to an end user and cannot proceed until this issue is resolved.

I did see a tutorial on importing PPT to lesson on YouTube. The tutorial at the end shows this feature of importing image into lesson page and it displays too. I tried to implement the same at my end and it did not work for me. That is the images in the ppt as well as the images added to the pages later on did not display.

 I am not sure of the moodle version used in that tutorial. However, it seems that at some point this feature was working fine.

- Swapna

In reply to Swapna Lonkar

Re: Lesson does not display images

by Chris Collman -
Picture of Documentation writers
Hi Swapna,
I have a Moodle 1.9.7 Localhost on my computer in my office at home. I downloaded the backup of Moodle Features Demo course and restored it to the localhost webserver. This allows me to check the course using two different servers (my own and moodle.org's). The Basic Lesson in Section 7 acted the same in both.

Just to be clear, this is not your issue. The "Features" issue was caused by an administrator or another teacher deleting things they did not think were necessary. It happens. However, I will explain a few things and perhaps you might be able to use this to solve your issue. In Features Demo, we have 2 lesson pages, one displays an image and the other does not display an image (the error).

In the first page "Question with graphics and no answers" should display a Moodle logo at the top. It does not because it is looking for a folder "Media_examples" with a subfolder "Moodle_Logos" that no longer exists. In edit mode, click on the text "Moodle logo", then the picture icon on the HTML toolbar. This will display the complete html address to the image. In Features Demo course, under files, we should see the folder Media_examples" and we do not. Thus this is an example of where the image address no longer exists and how it looks.

The next page is "Edit Order, Navigation Order, and Jumps". Second page in edit mode displays the "continue" button in the middle of a line of text and this is also an image. So this image works. Clicking on the image and the picture icon tool, we can see the address is demo.moodle.net/file.php/5/Lesson/Button_continue.JPG. When we look in files (course administration block) or with the picture tool, we can find a folder called "lesson" with the image in it.

I do not think your problem is the path to the image. It is more likely something to do with the theme, CSS or perhaps the Lesson module is corrupt on your server and needs to be reloaded. I am not aware of a site setting which would allow an image to display in a topic description but not in a branch table. My 1.9.7 Moodles do not have a problem displaying images in a branch table when they can find the file, thus my guess it is something to do with your specific web server or specific Moodle installationsmile I have created a branch table where the underlying code (see the Toggle HTML Source icon) was not behaving correctly and my ignorance could not fix it, except start over again with a blank page. That about covers all the potentials, except operator error.

I would suggest creating a course with just a single Lesson with a single branch page with just your image and see if that works. If it does not, then I would suggest creating a localhost, backing up and restoring the small course to the localhost. I will guess that you will not have a problem on the localhost. And/or, in theory, you could restore your big or small course to demo.moodle.net and see if it works there (it will be erased every hour and the bigger the file the longer it takes to upload). Or you could restore the Features Demo course to your primary server and localhost to see if it looks the same as demo.moodle. The results may give us more clues to where the issue is.

Another long post from Chris. You will notice that I have not looked at any code and only used tools available on the interface. Others in this forum are great with code but the issue for them is trying to narrow down wheresmile

Best Chris


In reply to Chris Collman

Re: Lesson does not display images

by Swapna Lonkar -

Hi Chris,

Thanx for your response. I'll try downloading Feature demo backup and see if it works on my end.

- Swapna

In reply to Swapna Lonkar

Re: Lesson does not display images

by Swapna Lonkar -

Hi Chris,

I downlaoded the latest version of moodle-installer and installed it on my localhost. Now i can see the images in lesson pages.

Thanx for all your help.

- Swapna

In reply to Swapna Lonkar

Re: Lesson does not display images

by Chris Collman -
Picture of Documentation writers
Hi Swapna,
What caused the other problem? When you figure that out, please post what you found out here smile Glad we were able to determine it was not a problem in at least 1 Moodle site.
Chris
In reply to Chris Collman

Re: Lesson does not display images

by Chris Robinson -
I think this is the same problem I am having.

src="<a href="http://moodle.mvsd.net/file.php/53/movieicon.jpg"

That code was copied from our site. As you can see, the a href is closing with a quotation mark before the file location is being determined. (At least I think, its been awhile since I have been using code)