Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
Undercover
Contributor II
Contributor II

List of Images in Content Libraries

Hello everyone,

Is there a way to display a list (links) to all image files in my media library? There are also subfolders and the number of image files is comparatively large. (In Qlikview you could simply display a list of all files in a folder.) I would like to use the list to have a preview of these images and the corresponding link. This should give the users in the system quicker access and not have everything displayed individually.

If there is already a preview, I would be grateful for this tip.

Many thanks and best regards

Labels (1)
3 Replies
Albarosæ
Contributor III
Contributor III

Hello, this will be a long post but you can do this as follows:

The script:

LET vFullPathToFolders = ;
LET vFullPathToFolder = ;

//You need to create a connection to this folder: Data\QlikShare\StaticContent
Full_Paths_To_Folder:
LOAD * INLINE [
	Full_Paths_To_Folder
    LIB://Content 
];

FullPathToFolders: 
LOAD 
	CHR(34) & Concat(Full_Paths_To_Folder, CHR(34) & ', ' & CHR(34)) & CHR(34) as FullPathToFolders
RESIDENT Full_Paths_To_Folder;

LET vFullPathToFolders = PEEK('FullPathToFolders', 0, 'FullPathToFolders');
DROP TABLE FullPathToFolders;

FOR z=1 TO NoOfRows('Full_Paths_To_Folder')
	LET vFullPathToFolder = PEEK('Full_Paths_To_Folder', $(z)-1, 'Full_Paths_To_Folder');
    
SET vConcatenate = ;

FileList:
LOAD
	'' as Full_Path_to_Source_File
AUTOGENERATE 0;

sub ScanFolder(Root)
	for each FileExtension in 'png','jpg','jpeg','ico' //image extensions
		for each FoundFile in filelist( Root & '\*.' & FileExtension)
			FileList:
			LOAD
				'$(FoundFile)' as Full_Path_to_Source_File
			AUTOGENERATE 1;

			SET vConcatenate = Concatenate;
		next FoundFile
	next FileExtension

for each SubDirectory in dirlist( Root & '\*' )
	call ScanFolder(SubDirectory)
next SubDirectory
end sub

Call ScanFolder('[$(vFullPathToFolder)]') ;

    FOR i=1 TO NoOfRows('FileList')
    
        LET vFull_Path_to_Source_File = PEEK('Full_Path_to_Source_File', $(i)-1, 'FileList');
        
        Images:
        LOAD
            '$(vFull_Path_to_Source_File)' as Full_Path_to_Source_File
        FROM [$(vFull_Path_to_Source_File)];
    
    NEXT i;

NEXT z;

Next you need to create a filter or a table:

Albaros_0-1697098351508.png

And add a map for rendering the images:

Albaros_1-1697098402161.png

And this is the settings for map:

1) Change base map to none from map settings

2) Add a background layer

3) Set format to image

4) Add URL from first "/" after library name (eg. /AppContent/123asd/image.png)

For this you can use mid() and find the spot where it is always starts from first "/" after library.

And finally for rendering an image you need to select only one path.

Undercover
Contributor II
Contributor II
Author

Hello Albarosæ,


wow, the answer is really long. Unfortunately, I first have to have a colleague set up the connection to the folder.


"LIB://Content" is the name of the connection correct?

Many thanks and best regards 🙂

Albarosæ
Contributor III
Contributor III

Yes, it is the name of the connection.

You are welcome 🙂