b3ta.com board
You are not logged in. Login or Signup
Home » Messageboard » Message 3777458

# Short, Shocking Confession
Despite lurking on and off for about a year, it's only just occurred to me what 'pearoast' is supposed to mean.

Doh!
(, Sat 2 Oct 2004, 14:01, archived)
# its
hilarious, no?
(, Sat 2 Oct 2004, 14:01, archived)
# Yep
Morning all-

Btw, PHP question.

Anyone know (and remember I can't code php for fuck), how to make a script to detect whether it's ie and show imageie.gif and if not, show image.gif?

Thanks
(, Sat 2 Oct 2004, 14:03, archived)
# you'll want to parse HTTP_USER_AGENT
but remember that browsers lie about what they are all the time - and defining "IE" can get a bit tricky (does Maxthon count, for example?)
(, Sat 2 Oct 2004, 14:10, archived)
# Just something that doesn't allow png transparency.
(, Sat 2 Oct 2004, 14:13, archived)
# ah, you'll probably be wanting this instead...
(, Sat 2 Oct 2004, 14:15, archived)
# well, i recomend this-
www.mozilla.org.uk/products/firefox/

it's just the site i'm making is going to be viewed by computer illiterate mothers, and they'll most likely all use ie, so I want it to work for both.
(, Sat 2 Oct 2004, 14:22, archived)
# umm...
i take it you didn't read any of those links? you *can* get IE to use the full alpha channel with a little bit of css hackery.
(, Sat 2 Oct 2004, 14:25, archived)
# I've bookmarked those links
they will prove very handy I'm sure.
(, Sat 2 Oct 2004, 14:28, archived)
# Oh right.. I thought they'd be some sort of IE plugin...
Sorry.. *ashamed look*
(, Sat 2 Oct 2004, 14:39, archived)
# hmm... IE5.5+ only
was hoping for IE5+.
(, Sat 2 Oct 2004, 14:51, archived)
#
I know!

use if (stristr($HTTP_USER_AGENT, "MSIE")) { echo "<img src="\" />"; } else { echo "<img src="\" />"; }

(Probably managed to add an error somewhere, as I'm thick, but thats the jist of it. And I can't be bothered to fix the image codes. Oh well.)
(, Sat 2 Oct 2004, 14:12, archived)
# *tries*


It works! Horay! (Well, no errors yet)
(, Sat 2 Oct 2004, 14:14, archived)
# that'll catch a default opera config as well
(so at least throw away anything that contains "Opera")

hate to say it, but server-side browser-sniffing is a horribly-flawed idea.

EDIT: also, when the overwhelming market-share is held by (in this case) the lowest common denominator (IE), you really want to be doing it the other way around - serve the gif by default, and the png only to certain select browsers.
(, Sat 2 Oct 2004, 14:19, archived)
# But IE is the only one that doesn't allow png transparency isn't it?
(, Sat 2 Oct 2004, 14:24, archived)
# pretty much,
my way was just safest (and supports random older browsers like NN4)

found another oddball for you -- IE/mac apparently supports 8-bit alpha-channels without hackery.
(, Sat 2 Oct 2004, 14:38, archived)
# really?
so it's just crappy ol' microsoft then, eh?
(, Sat 2 Oct 2004, 14:42, archived)
# .
realisation is a bitch innit :)
(, Sat 2 Oct 2004, 14:04, archived)
[challenge entry] While the kettle's on...


My first 'gif'. Apols for the overly-contrived misheard doodahd.
(, Sat 2 Oct 2004, 14:20, archived)