I'm showing my images with php.
function showImage( $id = 0 ){
$img = $this->db->where('id' , $id )->get('images');
$src = base_url('files').'/'.$img['filename'] ;
$ext = explode('.' , $img['filename']);
switch( end($ext) ) {
case "gif": $ctype="image/gif"; break;
case "png": $ctype="image/png"; break;
case "jpeg":
case "jpg": $ctype="image/jpg"; break;
default:
}
header('Content-type: ' . $ctype);
echo file_get_contents($src);
}
It works fine when I put address directly in the browser , but when I call it with fancybox it show a very big screen with nothing in it and I get lots of
���F���!1AQ"aq� 2��#B��R�3�$r��Cb�%&4c�����������������������#�������!1AQa2"q������?��P�����������
In the firebug in response to fancybox ajax request.