Supporting each other

Community forums

Welcome, Guest
Username: Password: Remember me
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.
  • Page:
  • 1

TOPIC: path to image

path to image 6 years 10 months ago #1878

  • rhvanloenen
  • rhvanloenen's Avatar Topic Author
  • Offline
  • Expert Boarder
  • Expert Boarder
  • Posts: 125
  • Thank you received: 6
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

Please Inloggen or Create an account to join the conversation.

Last edit: by rhvanloenen.

path to image 6 years 10 months ago #1885

  • rhvanloenen
  • rhvanloenen's Avatar Topic Author
  • Offline
  • Expert Boarder
  • Expert Boarder
  • Posts: 125
  • Thank you received: 6
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.

Please Inloggen or Create an account to join the conversation.

Last edit: by rhvanloenen.

path to image 6 years 10 months ago #1889

  • jjs
  • jjs's Avatar
  • Offline
  • Platinum Boarder
  • Platinum Boarder
  • Posts: 382
  • Thank you received: 65
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:
function x_pageLoaded() {
	x_pageInfo[x_currentPage].built = $("#x_page" + x_currentPage);
	
	$("#x_page" + x_currentPage)
		.hide()
		.css("visibility", "visible")
		.fadeIn();
}

Change this to:
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 Inloggen or Create an account to join the conversation.

path to image 6 years 10 months ago #1897

  • rhvanloenen
  • rhvanloenen's Avatar Topic Author
  • Offline
  • Expert Boarder
  • Expert Boarder
  • Posts: 125
  • Thank you received: 6
Thanks.
Tested with review, local and electronic learning environment of my school. Works fine!

Please Inloggen or Create an account to join the conversation.

path to image 6 years 10 months ago #1935

  • rhvanloenen
  • rhvanloenen's Avatar Topic Author
  • Offline
  • Expert Boarder
  • Expert Boarder
  • Posts: 125
  • Thank you received: 6
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 Inloggen or Create an account to join the conversation.

  • Page:
  • 1
Moderators: ingdonkatber
Time to create page: 0.049 seconds
Copyright © 2021 The Xerte Project.
Xerte logo Apereo logo OSI Logo

Search