Resource types

 
 
Picture of Alicia Wallace
Re: File resource html page, links to documents broken
 

Sweary McSwear Swear.

So it turns out that when you have multiple files in one file area the path is very slightly different, so the 3rd pdf in my list has the path:

moodle/pluginfile.php/26768/mod_resource/content/5/attitudes_e.pdf

and the 4th has the path

moodle/pluginfile.php/26768/mod_resource/content/6/energy_continuum_e.pdf

So the commenter above was exactly right - I can't simply tell it to look for the file name, I have to find out what number is given to each pdf.

Am going to try putting all the pdfs into a subfolder within the file resource, and see if that works without numbering each item. I'll keep you posted...

 
Average of ratings: -
Picture of Alicia Wallace
Re: File resource html page, links to documents broken
 

moodle/pluginfile.php/26768/mod_resource/content/5/pdf/attitudes_e.pdf

moodle/pluginfile.php/26768/mod_resource/content/6/pdf/energy_continuum_e.pdf

Putting the files in a subfolder creates the same problem (see modified URLs above). I have to assume it's to do with the file type but haven't got the time to look into this properly sad

 
Average of ratings: -
Picture of Dan O'Reilly
Re: File resource html page, links to documents broken
 

Hi,

I recently became involved in tracking the issue of linking from an HTML file to a resource, such as an image (.jpg in this case) in Moodle 2.2.6+.   I have an .html document that contains the following code "<img src='graphics/dreamstime_xs_12168180.jpg' alt='camp' width='480' height='319' hspace='20' vspace='10' align='left'>".  I go to File Picker and upload the HTML file by means of the tool 'Add a Resource' ... selecting 'File'.  I upload the HTML file, I then create a folder named 'graphics', go to that folder and upload the JPG into the subfolder.  I save and return to Topic.  I then attempt to view the HTML file and the image is broken.  I also have access to both an install of Moodle 2.1 and an install of Moodle 2.3 and I do basically the same and the image is not broken, the graphic file displays correctly.  Actually in 2.3 there is now an option after uploading the graphic file to define the path, where I select '/graphics/'.  From the discussion I find on this thread, Moodle 2.2 does not allow this HTML development.  Instead one has to find the Moodle path to the file and put that into one's HTML document.  Is this correct?

Thanks for any insight on this issue.

 
Average of ratings: -
Mary Cooch
Re: File resource html page, links to documents broken
Group Documentation writersGroup Moodle Course Creator Certificate holdersGroup Moodle HQGroup Particularly helpful MoodlersGroup TestersGroup Translators

Could you not zip the html file and the graphics folder with the image in together, then  upload them as a file resource, unzip them once uploaded and then set the "main file" as the html file -would it then show the image correctly?

 
Average of ratings: -
Picture of Dan O'Reilly
Re: File resource html page, links to documents broken
 

Hi Mary,

Just tried your suggestion and that didn't work either; it still displays a broken image ... or at least it displays the 'alt' name, which indicates it is reading the IMG TAG in my HTML document.  So, I identified how Moodle refers to the HTML file (in the following mymoodle is a pseudonym for my moodle):

http://mymoodle.net/moodle/pluginfile.php?file=%2F34%2Fmod_resource%2Fcontent%2F2%2FEthicalHumanResearchHistoryandPrinciples.html

From that I surmised that the JPG would have the following reference in Moodle:

img src="http://mymoodle.net/moodle/pluginfile.php?file=%2F34%2Fmod_resource%2Fcontent%2F2%2Fdreamstime_xs_12168180.jpg"

I placed that in the IMG TAG in my HTML file and uploaded it and the image displays as I want it to.  However, if I have to do this for all my files, it will take me a month to complete this module, whereas it should only take a few hours.  Not only that, if I move this module to another Moodle all the image tags will be broken.  There must be a more appropriate way.

Thanks,

Dan

 
Average of ratings: -
Ben talking on the phone beside a monitor
Re: File resource html page, links to documents broken
Group Particularly helpful MoodlersGroup Testers

Mary has a very good chapter on how to do this in her latest book. Let me expand a little, and she'll correct me if I go wrong.

You put the html and anything it links to (images, pdfs, what not) in one folder called "Folder." You zip that folder. You upload it to your Moodle via resources. You unzip the file. You now have "Folder" on your Moodle. You now have the option to choose the main file. You choose the html file. Save changes, and then the links will work.

No need to fool with the links.

Moodle 2+, being conscious of some 1.9 security lapses almost always (until 2.4, I think it is) provides an internal link that is not the actual link.

 
Average of ratings: -
Ben talking on the phone beside a monitor
Re: File resource html page, links to documents broken
Group Particularly helpful MoodlersGroup Testers

Two more ideas for you Dan.

  1. make sure that your folder depth is as expected. Occasionally, zipping a folder makes a folder with the same name inside a folder with the same name, which will be one too many levels for the URL you're using on the html page.
  2. Double check capitalization. Windows servers ignore capitalization. Linux servers do not. URL must match exactly the file name.

Personally, I'd also get rid of the underscores and just use FileName.jpg

 

 
Average of ratings: -
Picture of Dan O'Reilly
Re: File resource html page, links to documents broken
 

Hi Ben,

Thanks for the suggestions, but I ruled out the syntax issue by making a absolute link to the graphic file, which works fine and displays the graphic file without altering the syntax (other than making it an absolute link).  I also tried different levels, the same level and a subdirectory level, because of the way one has to define the level in Moodle 2.3.  I am in the process of setting up a version of Moodle 2.2.6+ on another server to see if the server is the issue.

Dan

 
Average of ratings: -
Picture of Alicia Wallace
Re: File resource html page, links to documents broken
 

Just a comment: This (create html file and related documents locally, test it worked, zip the whole lot and upload then set main file) is exactly what I did. The image links worked as expected, but the pdf links did not.

I identified (eventually) that all the pdfs were given a unique identifier in the url (moodle/pluginfile.php/26768/mod_resource/content/5/attitudes_e.pdf instead of moodle/pluginfile.php/26768/mod_resource/content/attitudes_e.pdf) and if anyone has an idea of how I can rid of that unique identifier, I would be so grateful.

 
Average of ratings: -
June 2007
Re: File resource html page, links to documents broken
 

Dan,

If the html file uses relative links, you shouldn't have any trouble referencing the image using Mary's solution. For example, if your image is in an "images/" folder in your "file" module, the html file can use src="images/dreamstime_xs_12168180.jpg"

 
Average of ratings: -
Picture of Dan O'Reilly
Re: File resource html page, links to documents broken
 

Hmm,

I am using a relative link within the HTML page to the image file.  And, as suggested, I zipped up the two files into a folder, uploaded the zipped file to Moodle (by adding a Resource ... File) and unzipped it in Moodle.  I then made the HTML file the 'main file'.  Still the link does not work.  As I mentioned in my first post, I have had no problem with exactly the same files, adding them as a Resource-File in a Moodle 2.1.1+ install and a Moodle 2.3.2 install.  The image works perfectly.

However, one big difference, other than the version of Moodle, is that the Moodle 2.2.6 install is on a GoDaddy Host.  I initially had a difficult time on this install even getting files to display, as I was receiving a 'No input file specified' error message.  To solve that problem I had to go to Admininstration > Server > HTTP and change the 'Use slash arguments' to no (from the default of Yes).  If as you, suggest this should work pretty much the same in Moodel 2.2.6 as it does in Moodle 2.1 and Moodle 2.3, then I am definitely thinking that this again must be a server issue.  Is there any other place that I should look?

Thanks for your suggestions,

Dan

 
Average of ratings: -
Picture of Dan O'Reilly
Re: File resource html page, links to documents broken
 

For those who have been following this thread, I set up a new install of Moodle 2.2.6+ on a different server and I can do what I wanted to do, i.e., I load an HTML document as a resource and that HTML doc contains the following code "<img src='graphics/dreamstime_xs_12168180.jpg' alt='camp' width='480' height='319' hspace='20' vspace='10' align='left'>" which is a relative link to a file in a sub-directory /graphics/ loaded as part of the resource.  Once the resource is saved and I return to the topic page, I can then click on the link and the HTML document along with the graphic is displayed.  Consequently, it appears to be something to do with the GoDaddy server and nothing to do with Moodle 2.2.6+.

Thanks for everyone who made suggestions, it definitely helped me to focus on a resolution.

Dan

 

 
Average of ratings: -
Picture of Philippe Decloitre
Re: File resource html page, links to documents broken
 

Thanks, Dan, for the following-up.

Have you now tried to backup and restore your course onto another Moodle.

I would be very interested in the outcome.

Cheers
Philippe

 
Average of ratings: -
Picture of Dan O'Reilly
Re: File resource html page, links to documents broken
 

Hi Philippe,

I was able to backup the course from the GoDaddy site and restore it to the new Moodle (same version 2.2.6+) and, now, the links in the course to the graphic file from the HTML file work.  Not sure whether the problem is how GoDaddy has their sever configured for PHP (this is my guess) or whether there was a problem with the original install (I had nothing to do with how Moodle was installed so not sure).

Dan

 
Average of ratings: -
Picture of Philippe Decloitre
Re: File resource html page, links to documents broken
 

Many thanks Dan, very useful info  smile

Cheers,
Philippe

 
Average of ratings: -