Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 4 of 4
  1. #1
    New to the CF scene
    Join Date
    Jan 2013
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Do you need a file extension for an image/photo to work on a website

    Hi:

    Disclaimer: I am brand new to the forum and I do not write code. However, I do have a question regarding coding: Does a photo coded into a website need an extension, such a .jpg, gif. etc. in order to display and work properly on a website? Or can a photo's file name be titled SUNSET, not have an extension, and will display and work properly? Is it possible to accidentally drag a photo from a website to your desktop that does not have a file extension as part of the file name? While I am writing in the HTML and CSS forum my question applies to all types of website coding formats, styles, program, etc.

    I would greatly appreciate any help on the subject.

  • #2
    Regular Coder
    Join Date
    Jul 2012
    Location
    London
    Posts
    473
    Thanks
    4
    Thanked 86 Times in 86 Posts
    Yes.

    It will need to be a "png, gif, jpg" but JPEG are used for large pixel pictures. "background etc"

  • #3
    The fat guy next door VIPStephan's Avatar
    Join Date
    Jan 2006
    Location
    Halle (Saale), Germany
    Posts
    8,666
    Thanks
    6
    Thanked 1,006 Times in 979 Posts
    Quote Originally Posted by tempz View Post
    Yes.
    I’m not so sure about that. I think you can display an image in a browser even without a file extension, as long as the MIME type is correct.

    But anyway, britannic: Why don’t you just try it? Save an image without extension and load it in different browsers and you know it.

  • #4
    Regular Coder
    Join Date
    Jul 2012
    Location
    London
    Posts
    473
    Thanks
    4
    Thanked 86 Times in 86 Posts
    Quote Originally Posted by VIPStephan View Post
    I’m not so sure about that. I think you can display an image in a browser even without a file extension, as long as the MIME type is correct.

    But anyway, britannic: Why don’t you just try it? Save an image without extension and load it in different browsers and you know it.
    Oh yes, I forgot that.

    Quote Originally Posted by http://stackoverflow.com/a/5110460
    The file extension isn't used for anything, really. The browser is checking for the Content-type header, which should be something like image/jpeg or whatever type of image you're serving.

    This is used pretty often in sites which dynamically serve images, often from a database. I've seen plenty of image URLs like image.aspx?id=37 which, while it technically has an "extension" doesn't really mean that it's an image. It's all in the HTTP header values.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •