Making a like button for images

Hello! I was wondering if it would be possible to create a like button for a photo. I am storing my photos in a database and showing them using a dynamic dataset. Is it possible to create a like button? The reason I want to make this function is that I am using a Wix pro gallery and it is connected to a database meaning the like feature Wix pro gallery has, doesn’t work. I also only want to let members like each photo once.
~Thanks~
Arthur :grinning:

Hi,

It’s definitely possible to create a like button for your images. In general, you’ll need to create a database collection to store and remove your likes and add multiple buttons for the different “liked” states for the UI.

In your case, can try creating your gallery with a repeater. You can then add an event listener with the at() selector function to target which item in the repeater is being clicked. Have a look at this example for reference.

Try it out and let us know if you run into issues. Remember to post a link to your site and post your code if you do. Also, if you’re able to build it successfully post your solution here as well for anyone else that may be looking for a solution.

Hope this was helpful. Good luck!

Ok I will try to replace the values with my own ok

Ok do I need to make a separate database for the photos and the likes? The frustrating thing using the example is I can’t look inside the database and can only see the default LIKE button ok