Images not displaying in JQuiz

Images not displaying in JQuiz

by kevin sheil -
Number of replies: 11
I've been trying to create a simple multiple choice quiz in Hot Potatoes which I need to upload to Moodle. I have saved the quiz and the images into the same folder on Moodle and copied the absolute URL of the images into the quiz. When I view them locally in my browser the images are appearing but when I go to view them on Moodle I just get an image placeholder.
Average of ratings: -
In reply to kevin sheil

Re: Images not displaying in JQuiz

by Gordon Bateson -
Picture of Core developers Picture of Peer reviewers Picture of Plugin developers
Hi Kevin,
first please make sure that the url has only a-z, A-Z, 0-9, "-", "." and "/". Anything else, for example spaces or non-ascii characters, can cause problems.

If the images still do not appear, please could you upload the quiz and the images to my Moodle server so we can all have a look at it together:
thanks
Gordon
In reply to kevin sheil

Re: Images not displaying in JQuiz

by Jeff Finnan -
<<< copied the absolute URL of the images into the quiz>>>

Not sure what you mean by copying. I usually use Insert > Picture > Picture from Local File. And get something like this:

What is the volume indicated in the following picture: <img src="39.5mL.jpg" alt="39.5mL.jpg" title="39.5mL" width="200" height="233" style="display: block; margin-left: auto; margin-right: auto; text-align: center;"></img>


In reply to Jeff Finnan

Re: Images not displaying in JQuiz

by Glenys Hanson -
Hi Jeff,

Just a couple of things :
  • actually what Hot Potatoes has made in your example is a relative link (an absolute link would begin in with http. Example :<img src="http://moodle.org/theme/moodle2/pix/" alt="moodle-logo.gif" title="Moodle" />
    This should be no problem as long as your picture (39.5mL.jpg) stays in the same folder as the Hot Potatoes .htm file in the Files area on Moodle.

  • notice in my example above the title (what the users see when they mouse over the picture) is different from the alt (the alternative text that browsers which don't read pictures "see"). In my example it doesn't really matter but in yours maybe it does if 39.5mL is the answer to the question.
If this doesn't help, upload your exercise to Gordon's site.

Cheers,
Glenys

In reply to Glenys Hanson

Re: Images not displaying in JQuiz

by Jeff Finnan -
Hi Glenys,

My Hotpot is working fine. Yep, I always keep them all in the same directory. I just showed mine as an example of how I do to Kevin.

Later.
Jeff


In reply to Jeff Finnan

Re: Images not displaying in JQuiz

by Gordon Bateson -
Picture of Core developers Picture of Peer reviewers Picture of Plugin developers

Hi Kevin,
thanks for uploading the quiz and image to my server approve

The url in your image is as an "https" absolute url. Any reason why you use https? Perhaps your whole site is https? Anyway, the current HotPot module is not expecting "https" in image urls, so it thinks this url is a relative url and tries to prepend the url of the Moodle folder where the quiz is, giving you something like this:

In the short term, there are two ways you can fix this yourself:

  • use a relative url:
    <img src="Fotolia_Business.JPG" />
In the longer term, I will fix the HotPot module so it is aware of https absoulte urls.

best regards
Gordon
In reply to Jeff Finnan

Re: Images not displaying in JQuiz

by Glenys Hanson -
Sorry, Jeff.

I didn't scroll up enough and realise you were replying to Kevin.
cheers,
Glenys
In reply to Glenys Hanson

Re: Images not displaying in JQuiz

by Gordon Bateson -
Picture of Core developers Picture of Peer reviewers Picture of Plugin developers
Hi Kevin,
I have updated the HotPot module (Moodle 1.5 - 1.9) now so it will recognize https absolute urls. You can use the new scripts next time your Moodle site is updated.

all the best
Gordon
In reply to Gordon Bateson

Re: Images not displaying in JQuiz

by Hari Ravi -

Hi All,

I think I found a simple solution for this.

I have created a new folder called 'images' at the root of the Moodle folder of my hosting server 

Then simply called that image within the Jquizz as a web URL Image: http+www+yoursitedotcom/images/picture1.jpg.

If you add the same image from the local server file to jquizz, the system will add some extra coding for size, alignment details. Copy them and add them below the URL and you are done!.

In reply to Hari Ravi

Re: Images not displaying in JQuiz

by Gordon Bateson -
Picture of Core developers Picture of Peer reviewers Picture of Plugin developers

Hari,
your system works for small Moodle sites run by one person who is the Moodle admin and who also has access to upload files to the server outsode of Moodle.

However, storing images out side of Moodle, is not a good solution for ordinary teachers who do not have access to upload files to the server outside fo Moodle.

Also, your system would make it difficult to move the HotPot activities intact to another Moodle site.

I strongly recommend that people keep the image files with the Hot Potatoes quiz files, so that as you move them around from your PC to one or more Moodle sites, the images will always be accessible.

In Moodle 2.0, 2.1 and 2.2, the file storage system does not allow files to be easily shared between activities, but from Moodle 2.3 we can store the files in a single repository, and then link to that repository from the Moodle HotPot activities. This is the most reliable solution for displaying images in HotPot activities.

Gordon

In reply to Gordon Bateson

Re: Images not displaying in JQuiz

by Hari Ravi -

Gordon,

Thanks for the response.

I have exhausted all other options before coming up with this and I did not say outsite moodle. I meant to say 'within' moodle installation folder (root of moodle installation) and in a new folder say images. 

This allowed me to call the images to Jquizz as an external URL but the URL is same as the site's name in case. (http+www+mymoodlesitedotcom/images/picture.jpg)

What I see is that there are two options when adding images: 1. External URL and 2. from Local machine. The pictures from local machine will not help for the same reasons you indicated and if the first option is selected, then the way I suggested should be just OK. Please correct me if wrong.

My point is if the technical issues are much of a headache as I found then this would be a simple solution within moodle.

Thanks

Hari

In reply to Hari Ravi

Re: Images not displaying in JQuiz

by Stan Bogdanov -

Hi Hary,

Although the folder is in the root, the problem is that Moodle is unaware that hese images are there. Potentially in the future:

  •  when you upgrade Moodle, this folder may disappear.
  • Another risk is that there will be all sorts of images and you have to develop a consistent naming convention for them to be able to manage them.
  • There's also the risk of overwriting the files if other people also upload files there.

Imagine the scenario where two people have named an image hat.png and it appears in several courses and your course displays somebody else's hat.png image in different size, etc.

On the other hand, that's what Moodle is - a Content management system and since Moodle is unaware of the images folder, you cannot manipulate it from within Moodle, you cannot manupulate the image files from wihtin Moodle - you always have to do it through FTP. All users with the respective rights can upload images to their courses. In your case, how many people will have access to FTP to upload images? And if I were the Admin, I wouldn't like to be responsible for dealing with everyone's image uploads all the time, especially when people are testing their exercises.

Now it's images, next comes audio and then video and you may end up with a completely new file system.

As a CMS, Moodle takes care of rewriting the relative paths to absolute paths, and so does HotPot (and other modules). If the https is the problem, then Gordon already solved it.

I'm sorry if I'm explaining something very basic but this must be your last resort; there must be other ways. I believe not all options are exhausted.

Cheers

Stan

Average of ratings: Useful (1)