为什么要下载我的图像而不是在浏览器中查看?

Image Link for testing

When I click the clink, Chrome, Safari and FF all automatically download a file rather the view it in the browser. How can I make it viewable in the browser? Using the link and a img tag works fine, it's just when used directly that it forces a download.

PHP

// Figure the mime type
$mimetypes = array(
    'png' => 'image/png',
    'jpg' => 'image/jepg',
    'gif' => 'image/gif',
    'css' => 'text/css',
    'js' => 'application/x-javascript'
);
$ext = strtolower(pathinfo($filename, PATHINFO_EXTENSION));
$mime = "application/octet-stream";
if(array_key_exists($ext, $mimetypes)) {
    $mime = $mimetypes[$ext];
}

header('Content-Type: ' . $mime);
header('Expires: 0');
header('Cache-Control: must-revalidate');
header('Pragma: public');
header('Content-Length: ' . filesize($filename));
readfile($filename);

This line has an error:

'jpg' => 'image/jepg', 

It should be

'image/jpeg'.

edit

The problem is that you set the content-type incorrectly. So the browser probably just gives up trying to guess what it is, and ask you to download.

$ curl -D- http://wiki.justinzaun.com/buzz_aldrin/media/aldrin/250
HTTP/1.1 200 OK
Date: Thu, 20 Jun 2013 07:34:45 GMT
Server: Apache
Expires: 0
Cache-Control: must-revalidate
Pragma: public
Set-Cookie: PHPSESSID=49e5d03f1f0cf87119eef5bc6bb68d4d; path=/
Content-Length: 24909
Content-Type: image/jepg

I suppose you tried it with jpg image. You have a typo in your $mimetypes array, which causes Content-Type to be wrong. It works fine for me, when I repaired it. This is the repaired array:

 $mimetypes = array(
    'png' => 'image/png',
    'jpg' => 'image/jpeg',
    'gif' => 'image/gif',
    'css' => 'text/css',
    'js' => 'application/x-javascript'
);