Images download instead of displaying in Safari

Discussion in 'OS X El Capitan (10.11)' started by Poverty2Prosperity.org, May 12, 2016.

Tags:
  1. Poverty2Prosperity.org macrumors newbie

    Poverty2Prosperity.org

    Joined:
    May 10, 2016
    #1
    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)
     
  2. DeltaMac macrumors 604

    DeltaMac

    Joined:
    Jul 30, 2003
    Location:
    Delaware
    #2
    hmm...
    Right-click on the image link, choose "Open Link in New Window", or whatever choice suits you.
     
  3. Poverty2Prosperity.org, May 12, 2016
    Last edited: May 12, 2016

    Poverty2Prosperity.org thread starter macrumors newbie

    Poverty2Prosperity.org

    Joined:
    May 10, 2016
    #3
    When I try that (either open in tab or window) on the following link, it still just downloads into download folder and does not show in Safari...

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

    Thanks,

    -Scott

    [Edited link to be directly to image...]
     
  4. DeltaMac macrumors 604

    DeltaMac

    Joined:
    Jul 30, 2003
    Location:
    Delaware
    #4
    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
     
  5. richard2 macrumors regular

    richard2

    Joined:
    Oct 21, 2010
    Location:
    England, United Kingdom
    #5
    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.
     
  6. Shirasaki macrumors 603

    Shirasaki

    Joined:
    May 16, 2015
    #6
    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.
     
  7. Poverty2Prosperity.org thread starter macrumors newbie

    Poverty2Prosperity.org

    Joined:
    May 10, 2016
    #7
    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]
     
  8. dsemf macrumors regular

    Joined:
    Jul 26, 2014
    #8
    [/QUOTE]

    I also get the download.

    Have you tried just:
    Code:
    image/jpeg jpeg jpg
    DS
     
  9. Poverty2Prosperity.org, May 13, 2016
    Last edited: May 13, 2016

    Poverty2Prosperity.org thread starter macrumors newbie

    Poverty2Prosperity.org

    Joined:
    May 10, 2016
    #9
    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
    --- Post Merged, May 13, 2016 ---
    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
     
  10. dsemf macrumors regular

    Joined:
    Jul 26, 2014
    #10
    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
    --- Post Merged, May 13, 2016 ---
    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
     
  11. Poverty2Prosperity.org thread starter macrumors newbie

    Poverty2Prosperity.org

    Joined:
    May 10, 2016
    #11
    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
     

Share This Page