Hey
I connected a gallery to a dataset and the new field type MediaGallery. I have no problem of adding images to that record in the dataset.
But, now I want a DELETE IMAGE so that a user can delete the selected image. The problem that occurs now is the following.
When I get the currentItem from the dataset and console.log the field “images” which is the MediaGallery field I get this.
0:
"{\"type\":\"Image\",\"description\":\"\",\"title\":\"\",\"height\":2558,\"width\":2052,\"src\":\"wix:image://v1/19819c_5f4c5a616915446494cedc0084c17872~mv2_d_2052_2558_s_2.png/_.png#originWidth=2052&originHeight=2558\"}"
1:
"{\"src\":\"image://v1/19819c_3d02076f2c034b3988449ee2a22d08a4~mv2_d_2760_2374_s_2.png/2760_2374/19819c_3d02076f2c034b3988449ee2a22d08a4~mv2_d_2760_2374_s_2.png\",\"description\":\"\",\"title\":\"\"}"
So for some reason one image is added to the gallery as an image:// and the other as a wix:image. Then I use the below when DELETE BUTTON is clicked:
let currentItem = $w("#gallery").currentItem;
And I get the current selected image and console.log that and gets the below:
type: "Image" description: "" title: "" height: 2374 width: 2760 src:
"wix:image://v1/19819c_3d02076f2c034b3988449ee2a22d08a4~mv2_d_2760_2374_s_2.png/_.png#originWidth=2760&originHeight=2374"
And now when it is added to the gallery it transforms to a wix:image so I can’t compare the src property of the image to know which one in the array I am supposed to delete.
Is this some bug or intentional? I guess I can add some key to the title and use that but it would make more sense to compare the src values of the images.