How to create an edittable image gallery

I want my members to be able to create an article and upload images into a gallery.
So basically I need a image gallery which allows you to (1) upload images, (2) store the image references into a data collection, (3) let the gallery enable the member to rearrange the uploaded images in the gallery and (4) let the gallery enable the member to remove an image from the gallery.

I haven’t found an wix element to do this nor a npm package to meet me some way.

I did manage to do (1) and (2).
I also found a way to build a gallery with a custom element in preparation to (3) and (4).
This way is not nice because wix does not allow you set data on a custom element (only attributes as far as I could see), but at least it’s something.

However now I encounter the next problem (argh, again).
The urls from the uploaded image are ‘wix’ urls and guess what: these can be resolved by the media manager on the backend ONLY!

Any pointers on how to get this done will be much appreciated!

Ps I did manage to do something with basic wix elements, but it’s very limited and fragile (most of the time the page loads fine, sometimes it crashes for unknown reason when loading the scripts).

Hey you can pass data to custom elements via attributes . Attributes only support string, so you need to stringify and then parse the data in the component

There are ways to translate Wix URL into public URL, do some search in the forum.

The way I manage this is by having a multi-upload button connect to a repeater. You can then reorganize items within the repeater. Finally you can save all those images as in a gallery field so you can display them via a gallery Element.

@quentin I know and I consider this a poor man’s solution making the dom overly heavy.
Also regarding the image url I have an update.
The API documentation of the media manager (backend) implies that it could solve the url, but it does not!
So I have another poor man’s solution grabbing the relevant part from the ‘wix’ url and append it to the static wix image url.
Ugly stuff!