biati-digital / glightbox

Pure Javascript lightbox with mobile support. It can handle images, videos with autoplay, inline content and iframes
MIT License
2.03k stars 228 forks source link

Image in Base64 #518

Open pawelszewczak opened 1 month ago

pawelszewczak commented 1 month ago

Script does not correctly recognise base64 images

You could change this line:

(e = e.toLowerCase()).match(/\.(jpeg|jpg|jpe|gif|png|apn|webp|svg)$/)

with this:

(e = e.toLowerCase()).match(/\.(jpeg|jpg|jpe|gif|png|apn|webp|svg)$|^data:image\/(jpeg|jpg|jpe|gif|png|apn|webp|svg);base64,/)

gingerchew commented 1 month ago

Hey there @pawelszewczak

That's an interesting idea. Currently we're in a PR freeze while we get ready for the next version of GLightbox. Is there a reason you're relying on base64 images? Outside of using them inside of CSS, it is a tool I rarely reach for and am interested.

pawelszewczak commented 1 month ago

@gingerchew

I retrieve images from a database and upload them to my mobile app just in Base64 format.

gingerchew commented 1 month ago

Hmmm, interesting, and this is to avoid costs associated with hosting files? I'll leave this open so that we can reference it in the future as a possible addition.