store images from a lightbox in the database

the problem is that I have not opened the lightbox programmatically. It was created using Wix functionality. So, when I run the getContext() function I get “undefined” in the console.
Somehow the lightbox is different to a normal page.
It is weird though that I can access text fields without a problem, only the image gallery is not working