noelboss / featherlight

Featherlight is a very lightweight jQuery lightbox plugin. It's simple yet flexible and easy to use. Featherlight has minimal css and uses no inline styles, everything is name-spaced, it's completely customizable via config object and offers image, ajax and iframe support out of the box. Featherlights small footprint weights about 4kB – in total.
https://www.noevu.ch/featherlight-js-the-ultra-slim-lightbox/
MIT License
2.08k stars 293 forks source link

Images served without a file extension are not displayed properly #362

Open ojathelonius opened 6 years ago

ojathelonius commented 6 years ago

Since content is determined with regex, static files that are not served with their file extension (either as a base64 image, or served with a given route) are not displayed properly.

Example

Featherlight could check the response headers through jQuery's XHR parameter instead of analyzing the URL structure to determine the content-type ; there could also be a way to force the expected content ignoring the regex matches. I may have misunderstood the docs but couldn't find a way to do this yet.

ponschab commented 5 years ago

If you know for sure that you want to load images into Featherlight, you can set the attribute data-featherlight-type="image".

marcandre commented 5 years ago

Sorry I never chimed back on this. I don't see anything special in the example

ojathelonius commented 5 years ago

I probably pasted he wrong jsfiddle sorry ! I will try and replicate the issue and post a proper link.

ojathelonius commented 5 years ago

If you know for sure that you want to load images into Featherlight, you can set the attribute data-featherlight-type="image".

I can't believe I missed this in the docs. It seems to work just fine, as per this JSFiddle.

It would still be possible to automatically enforce the data type based on content-type in response headers, if provided.