I have a big problem displaying images in fancybox. Images are generated by PHP using header() and readfile() .
When I access the script directly from the browser, everything is fine, but when the request comes from fancybox JavaScript, suddenly the browser stops responding and after a long time in the load content area I get binary instead of image.
Here is the code:
ob_clean(); header('Content-Type: '.$post->post_mime_type); $name = basename($post->guid); $base = home_url(); $path= $_SERVER{'DOCUMENT_ROOT'}.str_replace($base,'',$post->guid); header ('Content-Disposition: inline; filename='.$name); header ('Content-length: ' .filesize($path)); readfile($path);
Content screen loaded in fancybox: http://img502.imageshack.us/img502/8535/screenq.png
source share