store images from a lightbox in the database

If the images aren’t already in a dataset, then they will simply all be in your Media Manager.
So, unfortunately for you, how do I put it gently that you are going to be a busy person?

You can simply put the image URL of the file from the Media Manager into a dataset and use that instead of physically adding the picture to a dataset field.

However, whichever way you go about it, either adding the image URL or adding the image directly, you will unfortunately have to manually get the image downloaded from the Media Manager or simply get the URL of each image.

https://support.wix.com/en/article/downloading-files-from-the-media-manager
https://support.wix.com/en/article/retrieving-the-url-of-an-image

Hopefully the person whoever did your site originally just by using the Wix Editor and no code, well cross fingers that they have a backup folder of all the images so that you don’t have to manually get them all yourself.

If you don’t have backups of your images then you will have to manually get each one I am afraid.

To save you some time, you could hard code each separate gallery once you have the image URL all done, at least that way you won’t have to paste them all into a new dataset.
https://www.wix.com/corvid/reference/$w.Gallery.html#ImageItem

Examples

Set the list of items for a gallery

$w("#myGallery").items = [{
  "type": "image",
  "alt": "A beautiful view",
  "title": "A View",
  "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"
}];