0

For some reason I can't get the image to display properly, its chucking out errors not telling me what’s wrong, any ideas?

CODE

$finfo = finfo_open(FILEINFO_MIME_TYPE);
header("Content-type:   ".finfo_file($finfo, $filepath));
finfo_close($finfo);
header('Content-length: '.filesize($filepath));
header('Content-Disposition: inline; filename="'.$file.'"');
header('X-Sendfile: ' . $filepath );

HEADERS

HTTP/1.1 200 OK
Date: Mon, 07 Apr 2014 13:45:37 GMT
Server: Apache/2.2.22 (Ubuntu)
X-Powered-By: PHP/5.3.10-1ubuntu3.10
X-Sendfile: /path/image.jpg
Content-Length: 0
Content-Disposition: inline; filename="image.jpg"
Keep-Alive: timeout=5, max=99
Connection: Keep-Alive
Content-Type: image/jpeg
John J
  • 195
  • 1
  • 1
  • 11

2 Answers2

0

Are you sure your file is there?

I see Content-Length: 0. I doubt you want to send empty file.

Try to remove headers output and replace it with echos to see where your scrit fails.

Andrew
  • 1,756
  • 3
  • 18
  • 31
  • Nevermind fixed it, turns out x-sendfile was not loading due to incorrect dir specified in apache config – John J Apr 07 '14 at 14:22
0

The above code did work, it was x-sendfile which was not configured properly in apache

John J
  • 195
  • 1
  • 1
  • 11