CodingForums.com

CodingForums.com (http://www.codingforums.com/index.php)
-   HTML & CSS (http://www.codingforums.com/forumdisplay.php?f=13)
-   -   Do you need a file extension for an image/photo to work on a website (http://www.codingforums.com/showthread.php?t=285123)

britannic 01-01-2013 09:52 PM

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.

tempz 01-01-2013 10:45 PM

Yes.

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

VIPStephan 01-01-2013 10:52 PM

Quote:

Originally Posted by tempz (Post 1303464)
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.

tempz 01-01-2013 11:29 PM

Quote:

Originally Posted by VIPStephan (Post 1303466)
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.



All times are GMT +1. The time now is 10:39 PM.

Powered by vBulletin®
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.