Fancybox not showing streamed image correctly

Our images also didn't have extensions and were just emitted from an ashx handler.

We ended up adding 'type':'image' to the fancybox declaration like:

$('.fb1').fancybox({'titlePosition':'inside','type':'image'})

Which worked perfectly.


See point 6 in the Fancybox FAQ:

FancyBox gueses content type from url but sometimes it can be wrong. The solution is to force your type, like so - $(".selector").fancybox({'type' : 'image'});

(required version 1.3+)


There is a regular expression inside the fancybox script file that needed to be amended in order for it to allow that file extension to be treated correctly.

imageRegExp = /\.(aspx|jpg|gif|png|bmp|jpeg)(.*)?$/i;

I've just added aspx for now, but will need to do some additional work in order to make it function correctly.