Using library images with dataset

Hi, I can use images as a dataset field, but I have seen that it is intended for using external images by providing its url. I can call an image located at the CMS server, but using a manually created folder inside the webserver root. Is it possible to call for an image located at the CMS library, usually outside the webserver root?

Its not possible at the moment, but it certainly could be done.


Notes for future implementation

https://github.com/xibosignage/xibo-cms/blob/develop/modules/datasetview.module.php#L593

add something like:

https://github.com/xibosignage/xibo-cms/blob/develop/modules/embedded.module.php#L415

Sorry, maybe I am misunderstanding what you mean, but I cannot see any difference between the line in the first block, the line in the second block and the actual line that is in the original file.
I see this is the line where the file is fetched and has to be changed to get the file directly from the CMS library. Right?

Sorry, that is my fault - I wasn’t at all clear (the pains of being in a rush all the time).

I posted those extra notes for my own reference when implementing the feature in the future - and I messed up the second link :laughing:.

I’ve corrected the second link now.

Ok, thanks.
With this information I have managed to use the library images with datasets:

In a quick test (sorry, no clean code, just for testing), I have commented line 598 in datasetview.module.php:

//$replace = ($isPreview) ? '<img src="index.php?p=module&mod=image&q=Exec&method=GetResource&mediaid=' . $file['mediaId'] . '" />' : '<img src="' . $file['storedAs'] . '" />';

and then added the following lines instead:

 // Check that this mediaId exists and get some information about it
 $entry = Media::Entries(null, array('mediaId' => $replace));

 if (count($entry) <= 0)
     continue;

 // We have a valid mediaId to substitute
 $replace = ($isPreview) ? '<img src="index.php?p=module&mod=image&q=Exec&method=GetResource&mediaid=' . $entry[0]->mediaId . '" />' : '<img src="' . $entry[0]->storedAs . '" />';

This has worked to show library images by providing its mediaID in the dataset field. However, this does not changes the behaviour of the ticker with datasets. Obviously the same should be done in ticker.module.php.

Maybe in the final solution, from the user point of view, it would be good to be able to use the media name too.
Thanks a lot.

I think that the final solution would be to have another column type:

  • Library Image
  • External Image

The library image would function with either the ID or the Name and the external image would use the URL as it currently does.

I think that would provide the best combination.

Good! This would be clean and flexible.