Do you have an image that displays perfectly in your browser when you download it from your website ...
... but you get occasional reports from users that it comes out as a string of hyroglyphics for them ...
The problem may be that the server isn't sending the right content-type header, and that most (but not all) browsers will see from the content that the file's not the right type that they have been told, and correct accordingly.
There are four places to check (locations given for the Apache httpd server):
a) the mime.types file in the conf directory of the server, where a line such as
image/jpeg jpeg jpg jpe
tells the server to tell the browser that anything with extensions .jpe, .jpg and .jpeg is a jpeg image
b) overrides to the mime.types file in the httpd.conf file (or its included files / modifiers such as .htaccess) such as:
AddType image/jpeg .pix
c) The default file type - also in the httpd.conf file:
DefaultType image/jpeg
hard to thing of a circumstance that you want want this particular default!
d) Within a script (CGI / Perl, PHP, etc) where the image type is set by the script itself. PHP example:
header("content-type: image/jpeg");
The examples above come from our training machines, with a variety of browsers. The image was working well on all except one system, where the addition of the header line within the PHP script (which uses the GD library) was necessary for it to render correctly.
Try the example above for yourself ... we have the PHP script that (now) is correct - always adds the header -
[here]. It's an unusual script in that - without parameters - it sends an HTML form, but with parameters, it send out an image. I suspect that may have fooled the old browser that had the problem before it was told!
(written 2011-01-14)
3360
Associated topics are indexed under
W504 - Web and Intranet - Not Just Text [2554] Adding retrospective ALT attributes to IMG - (2009-12-28)
[1806] Dealing with overhead cables in a photograph - (2008-09-21)
[1749] Using server side and client side programming together - (2008-08-11)
[1618] A small picture does not always cut it! - (2008-04-21)
[847] Image maps for navigation - a straightforward example - (2006-08-28)
[665] PHP Image viewing application - (2006-04-01)
[553] Keep that image small - (2006-01-03)
[351] Is photoajustment an addiction? - (2005-06-18)
H309 - PHP - Maps, Graphics and Geographics [3817] Fpdf - generating .pdf documents easily from your PHP program - (2012-07-24)
[3734] QR codes with marketing logos embedded - (2012-05-16)
[3584] QR codes - graphics images that provide quick phone links - (2012-01-18)
[3536] UK Mapping Data - and more to come - under government Open Data measures - (2011-12-03)
[3447] Needle in a haystack - finding the web server overload - (2011-09-18)
[3211] Computer Graphics in PHP - World (incoming data) to Pixel (screen) conversion - (2011-03-24)
[3197] Finding and diverting image requests from rogue domains - (2011-03-08)
[3027] Server logs - drawing a graph of gathered data - (2010-11-03)
[2939] Protecting your images from use out of context - (2010-08-29)
[2729] Uploading a document or image to its own URL via a browser - (2010-04-18)
[2675] Redirecting to your main domain for correct security keys - (2010-03-13)
[2583] Reducing image size on digital photos - PHP - (2010-01-17)
[2390] Dynamic / changing images on your web page - (2009-09-01)
[2361] Geocoding - converting address to latitude / Longitude with PHP via Google - (2009-08-14)
[2343] World Flags in your PHP pages - (2009-08-10)
[1956] Images for Christmas - (2008-12-21)
[1923] Making it all worthwhile - (2008-12-04)
[1756] Ever had One of THOSE mornings? - (2008-08-16)
[1752] Dynamic maps / geographics in PHP - (2008-08-13)
[1734] All around the world? - (2008-08-03)
[1724] addslashes v mysql_real_escape_string in PHP - (2008-07-27)
[1628] Gant charts - drawing them with a PHP script - (2008-05-03)
[1391] Ordnance Survey Grid Reference to Latitude / Longitude - (2007-10-14)
[1390] Converting from postal address to latitude / longitude - (2007-10-13)
[1389] Controlling and labelling Google maps via PHP - (2007-10-13)
[1194] Drawing hands on a clock face - PHP - (2007-05-19)
[1104] Drawing dynamic graphs in PHP - (2007-03-09)
[937] Display an image from a MySQL database in a web page via PHP - (2006-11-22)
[563] Merging pictures using PHP and GD - (2006-01-13)
[320] Ordnance Survey - using a 'Get a map' - (2005-05-22)
A603 - Web Application Deployment - Further httpd Configuration [4001] Helping search engines with appropriate 400 error codes - (2013-02-11)
[3955] Building up from a small PHP setup to an enterprise one - (2012-12-16)
[3862] Forwarding a whole domain, except for a few directories - Apache http server - (2012-09-17)
[3635] Parse error: parse error, unexpected T_STRING on brand new web site - why? - (2012-03-03)
[3449] Apache Internal Dummy Connection - what is it and what should I do with it? - (2011-09-19)
[2900] Redirecting a page - silent, temporary or permanent? - (2010-08-03)
[2478] How did I do THAT? - (2009-10-26)
[2272] Monitoring and loading tools for testing Apache Tomcat - (2009-07-07)
[2060] Database connection Pooling, SSL, and command line deployment - httpd and Tomcat - (2009-03-01)
[1974] Moving a directory on your web site - (2009-01-03)
[1955] How to avoid duplicating web page maintainance - (2008-12-20)
[1954] mod_rewrite for newcomers - (2008-12-20)
[1939] mod_proxy_ajp and mod_proxy_balancer examples - (2008-12-13)
[1778] Pointing all the web pages in a directory at a database - (2008-08-30)
[1767] mod_proxy and mod_proxy_ajp - httpd - (2008-08-22)
[1762] WEB-INF (Tomcat) and .htaccess (httpd) - (2008-08-20)
[1707] Configuring Apache httpd - (2008-07-12)
[1636] What to do if the Home Page is missing - (2008-05-08)
[1619] User and Group settings for Apache httpd web server - (2008-04-22)
[1566] Strange behaviour of web directory requests without a trailing slash - (2008-03-06)
[1564] Default file (MiMe types) for Apache httpd and Apache Tomcat - (2008-03-04)
[1554] Online hotel reservations - Melksham, Wiltshire (near Bath) - (2008-02-24)
[1551] Which modules are loaded in my Apache httpd - (2008-02-23)
[1381] Using a MySQL database to control mod_rewrite via PHP - (2007-10-06)
[1377] Load Balancing with Apache mod_jk (httpd/Tomcat) - (2007-10-02)
[1355] .php or .html extension? Morally Static Pages - (2007-09-17)
[1351] Compressing web pages sent out from server. Is it worth it? - (2007-09-14)
[1207] Simple but effective use of mod_rewrite (Apache httpd) - (2007-05-27)
[1121] Sharing the load with Apache httpd and perhaps Tomcat - (2007-03-29)
[1080] httpd.conf or .htaccess? - (2007-02-14)
[1009] Passing GET parameters through Apache mod_rewrite - (2006-12-27)
[934] Clustering, load balancing, mod_rewrite and mod_proxy - (2006-11-21)
[853] To list a directory under httpd on a web server, or not? - (2006-09-02)
[755] Using different URLs to navigate around a single script - (2006-06-11)
[662] An unhelpful error message from Apache httpd - (2006-03-30)
[649] Denial of Service ''attack'' - (2006-03-17)
[631] Apache httpd to Tomcat - jk v proxy - (2006-03-03)
[550] 2006 - Making business a pleasure - (2006-01-01)
[526] Apache httpd - serving web documents from different directories - (2005-12-12)
[466] Separating 'per instance' data from binaries and web sites - (2005-10-16)
[345] Spotting a denial of service attack - (2005-06-12)
53fe
Some other Articles
Training Classes - should the training company provide a system for each delegate to use? A framework with python - Django - first stepsA time to be brave? We should ask for what is best for our area.Melksham Weather - Warm and windy becoming colder and calmerAn image from a website that occasionally comes out as hyroglyphicsVirtual Hosting with Apache http server - an overall scheme, and avoiding common pitfallsLua, Tcl, Python; Worldwide training classesNew Computers for delegates to useExtra courses - C and C++ How does your browser find out about itself?