Dit is een Nederlandse categorie binnen dit forum. Hier kun u vragen stellen, antwoorden geven en opmerkingen plaatsen in het Nederlands.
De items in het Engelstalige forum deel worden hier niet automatisch geplaatst. Wanneer u hier geen antwoord vindt kunt u ook de Engels- (of anderstalige) categorie raadplegen.

path to image

  • rhvanloenen
  • Topic Author
  • Offline
  • Premium Member
  • Premium Member
More
12 years 2 months ago - 12 years 2 months ago #1878 by rhvanloenen
path to image was created by rhvanloenen
with the property image I use FileLocation + 'media/10.JPG'
with script in textfield I use <img src="http://localhost/xertetoolkits/USER-FILES/1-guest2-Nottingham/media/10.JPG"/>

But making a html-export the path of the script doesn't exist anylonger when zip is unpacked on another laptop.

Now I tried to rewrite the sript, but I do something wrong? What wil be the correct script of:
<img src="/media/10.JPG" >

Ronald
Last edit: 12 years 2 months ago by rhvanloenen.

Please Log in or Create an account to join the conversation.

  • rhvanloenen
  • Topic Author
  • Offline
  • Premium Member
  • Premium Member
More
12 years 2 months ago - 12 years 2 months ago #1885 by rhvanloenen
Replied by rhvanloenen on topic path to image
Found the solution:
<img src="/media/10.JPG"> has to be <img src="./media/10.jpg"/>
The point before the first /

Caution. This script only works when LO is accessed through a browser, either locally or updated anywhere on the Internet.
It does not work with review in XOT itself!

After finishing the LO, I make a copy of the LO in Xot.
Then I go to the user folder in xampp/htdocs.... and in data.xml and preview.xml and use find and replace the original image script into the new one.

<img src="http://localhost/xertetoolkits/USER-FILES/1-guest2-Nottingham/media/10.JPG"/>
will be
<img src="./media/10.JPG">

Exporting this LO for use.

Be carefull, don't mixed up the two learning objects that you have now. Fitrst is the original.
Last edit: 12 years 2 months ago by rhvanloenen.

Please Log in or Create an account to join the conversation.

More
12 years 2 months ago #1889 by JohnSmith
Replied by JohnSmith on topic path to image
Thanks Ronald for reminding me of this...

And just for you... well obviously not JUST for you but you know what I mean...

If you add this code to your xenith.js file then it will fix the issue once and for all... hopefully...

At around line 900 in the latest version (might be slightly different in yours) you should see a function:
Code:
function x_pageLoaded() { x_pageInfo[x_currentPage].built = $("#x_page" + x_currentPage); $("#x_page" + x_currentPage) .hide() .css("visibility", "visible") .fadeIn(); }

Change this to:
Code:
function x_pageLoaded() { x_pageInfo[x_currentPage].built = $("#x_page" + x_currentPage); $("#x_page" + x_currentPage + " img").each(function(index) { var $this = $(this), src = $this.attr("src"); if (src.substring(0, 16) == "FileLocation + '") { src = eval(src); } $this.attr("src", src); }); $("#x_page" + x_currentPage) .hide() .css("visibility", "visible") .fadeIn(); }

This mean that you can use the exact same FileLocation + '.......' code in the main text and xenith will find and replace. Makes it a lot easier for this type of situation.

It works here but I will probably move this snippet somewhere more relevant later (just in case anyone is reading this retrospectively) and I will try to extend to work with other html tags like <a> <audio> <video> etc but this is a good start.

John
The following user(s) said Thank You: rhvanloenen

Please Log in or Create an account to join the conversation.

  • rhvanloenen
  • Topic Author
  • Offline
  • Premium Member
  • Premium Member
More
12 years 2 months ago #1897 by rhvanloenen
Replied by rhvanloenen on topic path to image
Thanks.
Tested with review, local and electronic learning environment of my school. Works fine!

Please Log in or Create an account to join the conversation.

  • rhvanloenen
  • Topic Author
  • Offline
  • Premium Member
  • Premium Member
More
12 years 2 months ago #1935 by rhvanloenen
Replied by rhvanloenen on topic path to image
I thought it worked and it did it on my own laptop. Also in the electronic learning environment, but using a different laptop it didn't work anymore. The path was found to be apparently referring to my laptop, and not to the the new file location.
So the problem is still there, but may be I'm doing something wrong.

Please Log in or Create an account to join the conversation.

Moderators: ingdonkatber
Time to create page: 0.187 seconds
Copyright © 2026 The Xerte Project.
Xerte logo Apereo logo OSI Logo