Using a URL Field to create an image in the View List or View Single views

Re: Using a URL Field to create an image in the View List or View Single views

by Philip Leicester -
Number of replies: 0
Hi William,

not so much a trick in the preset, but a one of method of retrieving the image located in moodle .

This is what I did

To display all the records held in an image field

Display all the records with images in a list view.

Then using a Browser development console run the following script :

arr1= $x("//tr[td/a/img[@class='list_picture']]//img/@src")
arr2 = $x("//tr[td/a/img[@class='list_picture']]/td[3]/a")
arr1.forEach(function (item, index) {
console.log(index,"|", item.value,"|", arr2[index].text);
});

This will output a "|" separated list which can be manipulated in a spreadsheet, linked to the source data and then reimported with a text field with the url loaded.
Average of ratings: Useful (1)