Do I need file extensions in the <img> tags?

I have a web application in which logos will be displayed. Some of the logos will be in GIF format. Some of them will be in JPEG format.

I would like to standardize the file naming convention so that I can find the file with the Primary Key logo. For example, British Petroleum has a 1459 PC, and their logo is stored in / Images / Logos / C 1459

So my question is:

Are file extensions important? Can I just save the files and disable .JPG or .GIF and expect all browsers to be able to identify and display the file? Or do some browsers rely on a file extension for identification?

I tried this on a test computer with IE7 and it works fine, but I don't want to assume that all other browsers work the same.

EDIT: Next question. Does Hows define an IIS MIME type for a file without an extension?

+7
html iis
source share
3 answers

More important for the browser is the MIME type, which is transmitted with the file at boot time. Historically, some of them have returned to heuristics, such as a file extension, or tried to calculate based on transferred bytes, but if the MIME type is correct, there would be no need.

+10
source share

You will definitely want to test as many browsers as possible, but everything should be fine. As long as the file format is correct and the MIME type is transmitted properly, the browser should display the image very well. (Many sites will have β€œimages” with URLs such as: /images/dbimage.aspx? Id = 123)

Edit: More important for testing than different browsers are different types of images. If there are any types of images that are not sent with the correct MIME type, you will need to identify them and either contact them or deny them.

+2
source share

It seems to me a little ahead. Why not:

1) Convert all images to the same type when they are first saved?

or

2) Find the company image using a lookup lookup (e.g. match / Images / Logos / C1459. *) And upload a file that returns a positive match. Since you use primary keys, you can be sure that you only need to find one match for each company.

0
source share

All Articles