Thanks again Giri Zano, I think I am getting close but I’m still a bit confused. I’ve done a lot of coding in other languages but am new to Wix and their implementation of Javascript.
In my post I didn’t make a couple of things clear. My apologies.
1. The code I posted is within the onReady structure on the Lightbox.
2. The images I am trying to push into the gallery are in a data collection (Images) rater than links/URLs.
3. The query that is shown in my code snippet runs and generates the array I want to load/push into the gallery
4. The gallery is not connected to the collection using the GUI. Trying to use code to connect to the array.
5. I only need to load the images - don’t need the title, description, etc. Also no videos - just jpeg images.
6. Here is the gallery I am trying to use but I am open to a different version if that makes a difference.
I’ve posted the new code incorporating the details Giri Zano was kind enough to provide. I think I am closer but my lack off knowledge and experience are keeping me from getting this to work. Any comments or advice would be greatly appreciated. Many thanks for getting me this close.
//Load images into slideshow gallery on the Lightbox
//Run the query to get the images from the Images collection
let resultGallery = wixData.query( “ProjectImages” )
//.include(“projectId”)
.eq( “imageInclude” , true )
.eq( “projectId” ,projectRecord)
.gt( “sequence” , 1 )
.limit( 29 )
.find()
.then((results) => {
let firstItemGallery = results.items
//Get the list of items and the first item’s information
let itefirstItemGalleryms = $w( “#gallery1” ).items;
let type = firstItemGallery[ 0 ].type; // “image”
let src = firstItemGallery[ 0 ].src; // “wix:image from Images collection
//let description = items[0].description; // “Description”
//let title = items[0].title; // “Title”
//let link = items[0].link; // “http”//wix.com”
//Set the list of items for a gallery
$w( “#gallery1” ).items = [{
“type” : “image” ,
//“title”: “A View”,
//“src”: “w???”
“src” : “wix:image://v1/99bc1c6f66444769b531221214c885ac.jpeg/A%20View.jpeg#originWidth=3264&originHeight=2448”
//}
//, {
// “type”: “video”,
// “description”: “Another beautiful view”,
// “title”: “Another View”,
// “src”: “wix:video://v1/80c05f_e2c524db1f264178a8558c92dbf76fb0/_#posterUri=80c05f_e2c524db1f264178a8558c92dbf76fb0f000.jpg&posterWidth=1920&posterHeight=1080”
}];
//Add an item to a gallery
//This example retrieves the items of a gallery, adds a new item, and then overwrites the old items.
//This section shows the only visible error - doesn’t like “src”
let items = $w( “#gallery1” ).items;
items.push( {
“src” : firstItemGallery
//‘’“description”: “Description”,
//“title”: “Title”
} );
$w( "#gallery1" ).items = items;
console.log( "Query for gallery completed" )