473,388 Members | 1,370 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,388 software developers and data experts.

Question about IMG tags and file names

Rob
Do browsers determine the type of a file by either looking at it's contents
or it's file name when parsing an IMG tag? IE7 can be asked to display
"Photo.tmp" which is actually a JPG and it displays it correct.

Just worried that other browsers may to it a different way.

The reason it's called TMP is that the file is coming out of a SQL IMAGE
field and I don't have the original file name to hand.

Cheers< Rob.
Oct 6 '07 #1
3 1137
Are you saying you are saving the image in a file? This is unnecessary. The
standard way of serving database images is making a special page
GetImage.aspx that will get images from the database and stream them down
top the client in the http response. The image url will look like
"GetImage.aspx?id=xxx"/

--
Eliyahu Goldin,
Software Developer
Microsoft MVP [ASP.NET]
http://msmvps.com/blogs/egoldin
http://usableasp.net
"Rob" <rob_nicholson@nospam_unforgettable.comwrote in message
news:1d****************@newsfe5-win.ntli.net...
Do browsers determine the type of a file by either looking at it's
contents or it's file name when parsing an IMG tag? IE7 can be asked to
display "Photo.tmp" which is actually a JPG and it displays it correct.

Just worried that other browsers may to it a different way.

The reason it's called TMP is that the file is coming out of a SQL IMAGE
field and I don't have the original file name to hand.

Cheers< Rob.

Oct 7 '07 #2
Rob
Are you saying you are saving the image in a file? This is unnecessary.
The
The image is saved in a database. Imagine a gallery of photos like on
facebook. The application extracts the image from the database, writes it
into a file and then generates IMG tags to point to the download files.

It has to work this way - the generated pages are static, only updated
periodically.

So an IMG tag has to be used - the question is how to, with an IMG tag, does
the browser work out what type of file it is? Does it a) look and the
extension or b) look at the file header.

And if (b) is that true for all browsers?

Cheers, Rob.
Oct 7 '07 #3
The image is saved in a database. Imagine a gallery of photos like on
facebook. The application extracts the image from the database, writes it
into a file and then generates IMG tags to point to the download files.

It has to work this way - the generated pages are static, only updated
periodically.
Still the standard solution looks better to me. There is absolutely no
advantages in using files. You have to take care of deleting them, of file
naming, of scalability.
>
So an IMG tag has to be used - the question is how to, with an IMG tag,
does the browser work out what type of file it is? Does it a) look and the
extension or b) look at the file header.
b)
>
And if (b) is that true for all browsers?
To be 100% sure, you need to investigate about every browser separately.
For Mozilla this source
http://developer.mozilla.org/en/docs...nes_MIME_Types says:
....for images loaded via <img src>, Mozilla's image library will do content
sniffing (never extension sniffing) to find out the real type of the image.

Look also in this: HTTP content-type and browser support
http://www.byteflex.co.uk/http_conte...r_support.html
--
Eliyahu Goldin,
Software Developer
Microsoft MVP [ASP.NET]
http://msmvps.com/blogs/egoldin
http://usableasp.net

>
Cheers, Rob.

Oct 8 '07 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: Al Davis | last post by:
Note: I tried cross-posting this message to several newsgoups, including comp.lang.perl.misc, c.l.p.moderated, comp.infosystems.www.authoring.cgi, comp.lang.javascript and comp.lang.php. Nothing...
4
by: Porthos | last post by:
Hi All, I've been working on mining data from a schema file (all attribute data so far) and have come to the point where I need to get information that is contained in tags. For instance,...
1
by: bjam | last post by:
Hi, I am trying to create a sort of include file into my xsl files such that calling the following template will push these xml tags into my document such that the other xsl files can use these...
3
by: windandwaves | last post by:
Hi Gurus Does anyone know how I set the error trapping to option 2 in visual basic. I know that you can go to tools, options and then choose on unhandled errors only, but is there a VB command...
7
by: Capstar | last post by:
Hi NG, Does the following code invoke undefined behaviour? I compiled it and it runs fine. I think this is fine because I think the last 3 arguments of struct a are organised in memory the same...
23
by: Big Bill | last post by:
http://www.promcars.co.uk/pages/bonnie.php I don't believe they should be there, can I take them out without stopping the includes from functioning? I'm the (hapless) optimiser on this one... I...
14
by: Rob Meade | last post by:
Hi all, I'm working on a project where there are just under 1300 course files, these are HTML files - my problem is that I need to do more with the content of these pages - and the thought of...
2
by: Phil Galey | last post by:
I'm using the followg code to add the attribute overwrite='true" to a select list of XML tags in an XML document. The document is loaded from a file and just the tags with names matching what's in...
1
by: SM | last post by:
Hello, I have a couple of XML files that represent articles. Each XML file is unique. Meaning that overall the structure is the same but some tags in the xml file are not in the same place or...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.