Thursday, 5 September 2013

implications when file extension in src is different than the actual format

implications when file extension in src is different than the actual format

I was wondering if there are any implications if the filename specified in
the src attribute for the <img> tag is different than the actual image
format
for example, I can have an image with an extension like
<img src="avatar.pdf" alt="" />
or
<img src="avatar.html" alt="" />
and it still works.
Content-Type in the response headers are obviously different in each case,
but I guess web-browsers ignores it.
Given that there are so many platforms and web-browsers versions, are
there any implications?
Background:
The reason I am asking this is because I am working on an web app where
you can create HTML content with images. Same image can be referenced in
different places (user can select an image from repository). I need to let
user replace an image but without the need for the system to re-save all
the HTML pages which use that image. The image path has to be based on an
id which is tracked in database. But the problem is with file extension
when image is replaced. My idea is to keep image files without any
extension, i.e:
<img src="/Content/Images/1289371" alt="" />

No comments:

Post a Comment