Linked gallery - how to programmatically link gallery images to images uploaded in my wix space ?

I am uploading hundreds of images to my wix space :
im_0001.jpg

im_0500.jpg

I would like to display a gallery with these images.

I am linking my gallery to a database which I imported from a .csv. I am successfully linking the title and description fields but I’m failing to link to the image source.

I would have hoped to be able to programmatically write something like
wix/im_0001.jpg

wix/im_0500.jpg

in the database and use it as the source url but the links attributed to uploaded images are not predictable:
https://static.wixstatic.com/media/5eb0e2_fc49f07448164b67a794d49im_0001.jpg

with random letters in the middle of the url.

Actually, even entering by hand this url in the image source field is problematic: the image gets displayed only when the image gets clicked. It is not displayed when scrolling the unopened gallery.

Ideally I would have filled a .csv file with the addresses of the uploaded images. Is it possible ?

If not, is it possible to run some wix code to generate a gallery and access programmatically uploaded images ?

Thanks for any help

Hello @thomastemplier2 I am having the same issue. Did you find a solution to this?

When you upload a file to your Wix site, it is automatically assigned a name by Wix servers, hence the addition of all those extra characters.

https://www.wix.com/corvid/forum/community-discussion/how-to-import-images
https://www.wix.com/corvid/reference/$w.Image.html
https://support.wix.com/en/article/about-the-media-manager-568956

Thank you for your reply., @givemeawhisky . I am wondering if after/when I upload the images to the media manager, if there is a way to get the urls, without copying each url from the media manager and then pasting it into the database. Right now this seems to be the fastest way to put hundreds of images into a database.

I can’t upload the images with the rest of the data in csv file. Any ideas?

I used this workaround:

  • add all your images to your wix media space
  • create manually a gallery
  • manually add all your images from the wix media space (using shift you can click an arbitrary large number of images)
  • in the console type the following:

$w.onReady(function () {
let items = $w(“#gallery1”).items;

for (var i = 0; i < items.length; i++) {
let type = items[i].type;
let src = items[i].src;
let description = items[i].description;
let title = items[i].title;
let link = items[i].link;

console.log(src)
}
});

(make sure that you gallery is called gallery1, and if you want to print more properties simply add console.log(type), console.log(title) for example)

  • preview the page and in the log you should see a list of all the URLs that you can manually copy-paste and handle yourself

Hope it helps

Hey @ThomasT thank you for this, it worked! Is there anyway to display the src in a text element/user input/or a list on the page?