Images download instead of displaying in Safari

Poverty2Prosperity.org

macrumors newbie
Original poster
May 10, 2016
7
0
Hi, I'm a web site publisher and often I have to look at just an image that is on the web site. Images display fine in Safari when I load a page, but if I load just the image (e.g. www.somewebsite.com/image.jpg), Safari downloads the image to my downloads folder instead of displaying it within the browser. Can I change this so that Safari displays the image in Safari itself. If I use Firefox, the images shows in the browser.

Thanks,

-Scott

MacBook Pro with Retina display, OS X El Capitan (10.11.4)
Safari Version 9.1 (11601.5.17.1)
 

Poverty2Prosperity.org

macrumors newbie
Original poster
May 10, 2016
7
0
Last edited:

DeltaMac

macrumors G4
Jul 30, 2003
10,475
2,794
Delaware
Ah, I see what you mean.

Hopefully, someone else may respond.
I don't know how to assist you with that, other than suggesting that you use a different browser, which I'm guessing may not be suitable for you as a website publisher :D
 

richard2

macrumors regular
Oct 21, 2010
236
51
England, United Kingdom
Code:
$ curl -I http://www.saabnet.com/tsn/class/photos/13124/1.jpg
HTTP/1.1 200 OK
Date: Thu, 12 May 2016 21:53:50 GMT
Server: Apache/2.2.25 (Unix)
X-Powered-By: PHP/4.4.9
Connection: close
Content-Type: image/jpg
The server is misconfigured:

  • The MIME type for JPEG images is image/jpeg, not image/jpg.
  • The Content-length header is missing.
 

Shirasaki

macrumors G4
May 16, 2015
10,238
4,074
Code:
$ curl -I http://www.saabnet.com/tsn/class/photos/13124/1.jpg
HTTP/1.1 200 OK
Date: Thu, 12 May 2016 21:53:50 GMT
Server: Apache/2.2.25 (Unix)
X-Powered-By: PHP/4.4.9
Connection: close
Content-Type: image/jpg
The server is misconfigured:

  • The MIME type for JPEG images is image/jpeg, not image/jpg.
  • The Content-length header is missing.
But despite that, I can still view photos on it inside browser, rather than downloading it to "download" folder. Oh, I use safari for iOS.
 

Poverty2Prosperity.org

macrumors newbie
Original poster
May 10, 2016
7
0
Code:
$ curl -I
The server is misconfigured:
  • The MIME type for JPEG images is image/jpeg, not image/jpg.
  • The Content-length header is missing.
If you load this link in your Safari browser on Mac OS X, does it load in a window for you or download?

http://www.saabnet.com/tsn/class/photos/13124/1.jpg

My /etc/mime.types has this line:
image/jpeg jpeg jpg joe

The weird thing is that this file with the .jpeg extension does open in a window and does not get downloaded.

http://www.saabnet.com/tsn/tmp/test.jpeg

I tried editing the line to this since I don't use .jpeg with my site:

image/jpeg jpg

And tried this too:

image/jpeg jpeg jpg joe
image/jpg jpg

Nothing worked to get a .jpg file to open in a browser window.

Thanks,

-Scott[/code][/QUOTE]
 

dsemf

macrumors 6502
Jul 26, 2014
376
84
If you load this link in your Safari browser on Mac OS X, does it load in a window for you or download?

http://www.saabnet.com/tsn/class/photos/13124/1.jpg

My /etc/mime.types has this line:
image/jpeg jpeg jpg joe

The weird thing is that this file with the .jpeg extension does open in a window and does not get downloaded.

http://www.saabnet.com/tsn/tmp/test.jpeg

I tried editing the line to this since I don't use .jpeg with my site:

image/jpeg jpg

And tried this too:

image/jpeg jpeg jpg joe
image/jpg jpg

Nothing worked to get a .jpg file to open in a browser window.

Thanks,

-Scott[/code]
[/QUOTE]

I also get the download.

Have you tried just:
Code:
image/jpeg jpeg jpg
DS
 

Poverty2Prosperity.org

macrumors newbie
Original poster
May 10, 2016
7
0
I also get the download.

Have you tried just:
Code:
image/jpeg jpeg jpg
DS[/QUOTE]

Sorry, the 'joe' should have been jpe (thanks, autocorrect). Anyway, I removed jp and used the line you suggested but I still get the image as a download rather than viewing it in the browser window...

Damn, if I try viewing a .jpg from this site in a browser window, it works fine...

-Scott
[doublepost=1463164454][/doublepost]I'm asking on an Apache forum why some of my images get served with the correct headers but not others... e.g.:

[x@saabnet class]# curl -I http://www.saabnet.com/images/spamcop.jpg
HTTP/1.1 200 OK
Date: Fri, 13 May 2016 18:16:59 GMT
Server: Apache/2.2.25 (Unix)
Last-Modified: Fri, 01 Dec 2006 01:38:49 GMT
ETag: "54401f1-9453-423810fc27c40"
Accept-Ranges: bytes
Content-Length: 37971
Connection: close
Content-Type: image/jpeg
X-Pad: avoid browser bug

vs

[x@saabnet class]# curl -I http://www.saabnet.com/tsn/class/131015ccaarsm.jpg
HTTP/1.1 200 OK
Date: Fri, 13 May 2016 18:19:00 GMT
Server: Apache/2.2.25 (Unix)
X-Powered-By: PHP/4.4.9
Connection: close
Content-Type: image/jpg

-Scott
 
Last edited:

dsemf

macrumors 6502
Jul 26, 2014
376
84
Sorry, the 'joe' should have been jpe (thanks, autocorrect). Anyway, I removed jp and used the line you suggested but I still get the image as a download rather than viewing it in the browser window...

Damn, if I try viewing a .jpg from this site in a browser window, it works fine...

-Scott
[doublepost=1463164454][/doublepost]I'm asking on an Apache forum why some of my images get served with the correct headers but not others... e.g.:

[x@saabnet class]# curl -I http://www.saabnet.com/images/spamcop.jpg
HTTP/1.1 200 OK
Date: Fri, 13 May 2016 18:16:59 GMT
Server: Apache/2.2.25 (Unix)
Last-Modified: Fri, 01 Dec 2006 01:38:49 GMT
ETag: "54401f1-9453-423810fc27c40"
Accept-Ranges: bytes
Content-Length: 37971
Connection: close
Content-Type: image/jpeg
X-Pad: avoid browser bug

vs

[x@saabnet class]# curl -I http://www.saabnet.com/tsn/class/131015ccaarsm.jpg
HTTP/1.1 200 OK
Date: Fri, 13 May 2016 18:19:00 GMT
Server: Apache/2.2.25 (Unix)
X-Powered-By: PHP/4.4.9
Connection: close
Content-Type: image/jpg

-Scott[/QUOTE]

I am assuming that you are stopping/starting Apache between your changes.

The interesting thing about your sample is that the first appears to be a direct load by Apache while the second one appears to be related to PHP processing. Maybe PHP is contributing to the problem. If PHP is involved, you may want to check if PHP is setting the content type.


DS
 

Poverty2Prosperity.org

macrumors newbie
Original poster
May 10, 2016
7
0
I am assuming that you are stopping/starting Apache between your changes.

The interesting thing about your sample is that the first appears to be a direct load by Apache while the second one appears to be related to PHP processing. Maybe PHP is contributing to the problem. If PHP is involved, you may want to check if PHP is setting the content type.


DS
Yes, graceful restart between config changes. Yes, I use PHP on the server, and yes, it does show that the request for that image is X-Powered-By: PHP/4.4.9 which is weird.. I have the server configured to just use PHP for files ending in .php (AddType application/x-httpd-php .php) unless otherwise specified by a .htaccess file. There is no .htaccess file in this directory or any above it. so I cannot figure out why PHP is serving a .jpg image...???!!! The image is not coming out of a PHP script.. it's a hard file accessed with a direct URL, just like the spamcop.jpg image, but in a different directory.

-Scott
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.