Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > HTML > Conditional image swap for IE6?

Reply
Thread Tools

Conditional image swap for IE6?

 
 
toxee
Guest
Posts: n/a
 
      11-18-2009
<div class="pearl">
<img class="pearl" src="pearl.png" alt="Pearl Davis Ministries"
title="Pearl Davis Ministries">
</div>

<div class="pearl">
<img class="pearl" src="pearl.gif" alt="Pearl Davis Ministries"
title="Pearl Davis Ministries">
</div>

Basically if the user is using something as old or older than IE6 I
wanted it to use gif format instead of png format. How do I do this
exactly?
 
Reply With Quote
 
 
 
 
dorayme
Guest
Posts: n/a
 
      11-18-2009
In article
<27eb79ac-cb0b-4d55-a531->,
toxee <> wrote:

> <div class="pearl">
> <img class="pearl" src="pearl.png" alt="Pearl Davis Ministries"
> title="Pearl Davis Ministries">
> </div>
>
> <div class="pearl">
> <img class="pearl" src="pearl.gif" alt="Pearl Davis Ministries"
> title="Pearl Davis Ministries">
> </div>
>
> Basically if the user is using something as old or older than IE6 I
> wanted it to use gif format instead of png format. How do I do this
> exactly?


The simplest thing, if you are really concerned, is to use gif all the
time rather than png. Show me an example of your images where you are
seeing such a great advantage of png over gif that you would be prepared
to go to the trouble of making two images, loading them and having them
on the server and making them available via conditional comments or
whatever to different browsers...

--
dorayme
 
Reply With Quote
 
 
 
 
Nik Coughlin
Guest
Posts: n/a
 
      11-19-2009
"toxee" <> wrote in message
news:27eb79ac-cb0b-4d55-a531-...
> <div class="pearl">
> <img class="pearl" src="pearl.png" alt="Pearl Davis Ministries"
> title="Pearl Davis Ministries">
> </div>
>
> <div class="pearl">
> <img class="pearl" src="pearl.gif" alt="Pearl Davis Ministries"
> title="Pearl Davis Ministries">
> </div>
>
> Basically if the user is using something as old or older than IE6 I
> wanted it to use gif format instead of png format. How do I do this
> exactly?


Because the PNG transparency looks bad with IE right? Super simple fix:

http://teqsnacks.com/2007/02/22/fixi...blem-with-ie6/

 
Reply With Quote
 
Jonathan N. Little
Guest
Posts: n/a
 
      11-19-2009
toxee wrote:
> <div class="pearl">
> <img class="pearl" src="pearl.png" alt="Pearl Davis Ministries"
> title="Pearl Davis Ministries">
> </div>
>
> <div class="pearl">
> <img class="pearl" src="pearl.gif" alt="Pearl Davis Ministries"
> title="Pearl Davis Ministries">
> </div>
>
> Basically if the user is using something as old or older than IE6 I
> wanted it to use gif format instead of png format. How do I do this
> exactly?


<object type="image/png" data="pearl.png"><img src="pearl.gif"></object>


--
Take care,

Jonathan
-------------------
LITTLE WORKS STUDIO
http://www.LittleWorksStudio.com
 
Reply With Quote
 
BootNic
Guest
Posts: n/a
 
      11-19-2009
On Wed, 18 Nov 2009 14:39:32 -0800 (PST)
toxee <> wrote:

> <div class="pearl"> <img class="pearl" src="pearl.png" alt="Pearl
> Davis Ministries" title="Pearl Davis Ministries"> </div>
>
> <div class="pearl"> <img class="pearl" src="pearl.gif"
> alt="Pearl Davis Ministries" title="Pearl Davis Ministries">
> </div>
>
> Basically if the user is using something as old or older than IE6
> I wanted it to use gif format instead of png format. How do I do
> this exactly?


Lifecycle IE6/7 13-Jul-2010

You may consider having the server redirect IE 6 request for selected
png files to gif files.

Browser sniffing you say, yes it is.

I would not consider this to be important enough to modify the HTML,
CSS or to use any form of JavaScript to cater to IE 6. It's simply not
worth the effort in my opinion.

An Apache RewriteRule to redirect IE 4-6 to gif images for peral.png,
hangman.png, stool.png may look something like:

RewriteCond %{HTTP_USER_AGENT} MSIE\s[4-6]
RewriteCond %{REQUEST_URI} (pearl|hangman|stool)\.png$
RewriteRule ^(.+)\.png$ $1.gif [L]



--
BootNic Wed Nov 18, 2009 08:50 pm
You can turn painful situations around through laughter. If you can
find humor in anything - even poverty - you can survive it.
*Bill Cosby*

⁕ 236 days remaining

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.12 (GNU/Linux)

iEYEARECAAYFAksEpHUACgkQmo2774GZ7qn+YwCglJKNUNs84u fYel1GXUC8ubVI
1XAAoPEwekImU8W1btPnyWP7dcojiVBT
=YwmX
-----END PGP SIGNATURE-----

 
Reply With Quote
 
toxee
Guest
Posts: n/a
 
      11-19-2009
On Nov 18, 4:14*pm, "Nik Coughlin" <nrkn....@gmail.com> wrote:
> "toxee" <midor...@yahoo.com> wrote in message
>
> news:27eb79ac-cb0b-4d55-a531-...
>
> > <div class="pearl">
> > <img class="pearl" src="pearl.png" alt="Pearl Davis Ministries"
> > title="Pearl Davis Ministries">
> > </div>

>
> > <div class="pearl">
> > <img class="pearl" src="pearl.gif" alt="Pearl Davis Ministries"
> > title="Pearl Davis Ministries">
> > </div>

>
> > Basically if the user is using something as old or older than IE6 I
> > wanted it to use gif format instead of png format. How do I do this
> > exactly?

>
> Because the PNG transparency looks bad with IE right? *Super simple fix:
>
> http://teqsnacks.com/2007/02/22/fixi...-display-probl...


So many suggestions in this thread already, thanks guys! Yes, it's to
avoid that hideous background for my transparent image of the client.
I see three different methods on that page, I'm not sure how I
implement any of the techniques though. Like where in my code would
they go. If I used the second method the class is,

img.pearl{

}

If it goes in the html portion of my page, where?
 
Reply With Quote
 
Adrienne Boswell
Guest
Posts: n/a
 
      11-19-2009
Gazing into my crystal ball I observed toxee <>
writing in news:27eb79ac-cb0b-4d55-a531-be634515d845
@d9g2000prh.googlegroups.com:

><div class="pearl">
><img class="pearl" src="pearl.png" alt="Pearl Davis Ministries"
> title="Pearl Davis Ministries">
></div>
>
><div class="pearl">
><img class="pearl" src="pearl.gif" alt="Pearl Davis Ministries"
> title="Pearl Davis Ministries">
></div>
>
> Basically if the user is using something as old or older than IE6 I
> wanted it to use gif format instead of png format. How do I do this
> exactly?
>


I use two different stylesheets, one for IE < 7 and one for the rest of
the world. The only thing that is in the IE sheet is the necessary
images, eg:


style_ie.css
#header {background-image: url(logo.gif);}

style.css
#header {background-image: url(logo.png);/*other rules*/}

Then I do this in the head:
<link type="text/css" rel="stylesheet" href="style.css" />
<!--[if lt IE 7]>
<link rel="stylesheet" type="text/css" href="style_ie.css" />
<![endif]-->


--
Adrienne Boswell at Home
Arbpen Web Site Design Services
http://www.cavalcade-of-coding.info
Please respond to the group so others can share

 
Reply With Quote
 
Nik Coughlin
Guest
Posts: n/a
 
      11-19-2009
"toxee" <> wrote in message
news:473da0e4-f4ad-4cc3-bfd5-...
On Nov 18, 4:14 pm, "Nik Coughlin" <nrkn....@gmail.com> wrote:
>
> Because the PNG transparency looks bad with IE right? Super simple fix:
>
> http://teqsnacks.com/2007/02/22/fixi...-display-probl...
>
> So many suggestions in this thread already, thanks guys! Yes, it's to
> avoid that hideous background for my transparent image of the client.
> I see three different methods on that page, I'm not sure how I
> implement any of the techniques though. Like where in my code would
> they go. If I used the second method the class is,


Use the first method, the pngquant one. You have to download the program and
run it from the command line, but it's pretty easy. You end up with an
indexed alpha png, which compliant browsers will display much like your
current png files, and which IE 6 and below will display with binary
transparency, ie like a GIF does, so it's win-win and you don't have to
change your code. You just have to run your png's thru that program is all.
Almost all PNGs will still look OK afterwards, if not use one of the other
methods.

 
Reply With Quote
 
toxee
Guest
Posts: n/a
 
      11-19-2009
On Nov 18, 7:26*pm, "Nik Coughlin" <nrkn....@gmail.com> wrote:
> "toxee" <midor...@yahoo.com> wrote in message
>
> news:473da0e4-f4ad-4cc3-bfd5-...
> On Nov 18, 4:14 pm, "Nik Coughlin" <nrkn....@gmail.com> wrote:
>
>
>
> > Because the PNG transparency looks bad with IE right? Super simple fix:

>
> >http://teqsnacks.com/2007/02/22/fixi...-display-probl...

>
> > So many suggestions in this thread already, thanks guys! Yes, it's to
> > avoid that hideous background for my transparent image of the client.
> > I see three different methods on that page, I'm not sure how I
> > implement any of the techniques though. Like where in my code would
> > they go. If I used the second method the class is,

>
> Use the first method, the pngquant one. You have to download the program and
> run it from the command line, but it's pretty easy. *You end up with an
> indexed alpha png, which compliant browsers will display much like your
> current png files, and which IE 6 and below will display with binary
> transparency, ie like a GIF does, so it's win-win and you don't have to
> change your code. *You just have to run your png's thru that program is all.
> Almost all PNGs will still look OK afterwards, if not use one of the other
> methods.


I see what you mean, I didn't know that exe was a converter. Photoshop
can save images in png8, I tried it and it looked just as jaggy as the
gif format. So is that what the program does, just convert it the same
way photoshop would?
 
Reply With Quote
 
Nik Coughlin
Guest
Posts: n/a
 
      11-19-2009
> "toxee" <> wrote in message
> news:38ec5c9f-f357-415c-a6b3-...
> On Nov 18, 7:26 pm, "Nik Coughlin" <nrkn....@gmail.com> wrote:
> > "toxee" <midor...@yahoo.com> wrote in message
> > news:473da0e4-f4ad-4cc3-bfd5-...
> > On Nov 18, 4:14 pm, "Nik Coughlin" <nrkn....@gmail.com> wrote:
> > Because the PNG transparency looks bad with IE right? Super simple fix:
> >
> > >http://teqsnacks.com/2007/02/22/fixi...-display-probl...

> >
> > > So many suggestions in this thread already, thanks guys! Yes, it's to
> > > avoid that hideous background for my transparent image of the client.
> > > I see three different methods on that page, I'm not sure how I
> > > implement any of the techniques though. Like where in my code would
> > > they go. If I used the second method the class is,

> >
> > Use the first method, the pngquant one. You have to download the program
> > and
> > run it from the command line, but it's pretty easy. You end up with an
> > indexed alpha png, which compliant browsers will display much like your
> > current png files, and which IE 6 and below will display with binary
> > transparency, ie like a GIF does, so it's win-win and you don't have to
> > change your code. You just have to run your png's thru that program is
> > all.
> > Almost all PNGs will still look OK afterwards, if not use one of the
> > other
> > methods.

>
> I see what you mean, I didn't know that exe was a converter. Photoshop
> can save images in png8, I tried it and it looked just as jaggy as the
> gif format. So is that what the program does, just convert it the same
> way photoshop would?


No, the only similarity is that it converts the png to an indexed image, but
when using pngquant the palette can also include colours with alpha
transparency (varying degrees of opacity), so you still get the ability to
antialias edges of the image against any background as you do with a 24 or
32 bit PNG.

Modern browsers display these correctly, without jaggies, and IE 6 throws
away the pixels that are alpha transparent, which makes the image look jaggy
like a gif

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
next / previous image swap WITH larger image popup Clay Javascript 1 09-28-2006 09:07 PM
What swap is called when using std::swap? Niels Dekker (no reply address) C++ 4 07-20-2006 08:44 PM
Allow multiple image swap onmouseover hadAnet ASP .Net 2 12-28-2005 06:56 PM
? ELSE Conditional Comment / Using Conditional Comments Inside Other Tags To Comment Out Attributes Alec S. HTML 10 04-16-2005 02:21 AM
Mouse-over an image -> play video instead of swap image? Phillip Roncoroni HTML 6 04-06-2004 06:57 AM



Advertisments