Nov 21, 2008, 07:01 AM *
Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
Search via SMF or Google: modx forums all of modxcms.com web
  MODxCMS.com   Forums   Help Login Register  
News:Read what MODx Developers say: MODx Dev. Blogs
Pages: [1] 2 3 ... 5   Go Down
  Print  
Author Topic: [Plugin] PNG-Alpha Transparency for MSIE  (Read 26601 times)
0 Members and 1 Guest are viewing this topic.
xwisdom
Foundation
*
Posts: 1,732



« on: May 30, 2005, 12:09 AM »

Hello Everyone,

Many thanks goes to Ryan for sharing this bit of code which I've managed to wrap inside a plugin so that it can be easily applied to your modx enabled website.

Trigger Event:
--------------------
OnWebPagePrerender

Plugin configuration:
----------------------
&spacer=PNG Spacer Path;string;assets/images &sm=Size Method;list;Scale,Crop,Image;Image

Create a new plugin with the above settings. Unzip the attached zip file and copy content of pngalpha4msie.txt into the plugin. Also copy the spacer.png image file into assets/images folder.

Here's an example of a png-24 alpha image tested in IE 6.0:

Note: You must be logged in before you can view images and download file attachments

Before (plugin disabled or not installed):


After (plugin enabled):



* pngalpha4msie.zip (11.86 KB - downloaded 977 times.)

* pngie.png (102.94 KB, 335x250 - viewed 1199 times.)

* pngie2.png (101.9 KB, 295x233 - viewed 1178 times.)
« Last Edit: May 30, 2005, 09:23 AM by xwisdom » Logged

xWisdom
www.xwisdomhtml.com
The fear of the Lord is the beginning of wisdom:
MODx Co-Founder - Create and do more with less.
zi
MODx Special Forces /
Administrator
*
Posts: 3,006


May Peace Be On You


WWW
« Reply #1 on: May 30, 2005, 01:40 AM »

Thanks for great Plugin  Cheesy

it is really good since IE does not support PNG transparency images.

Best wishes and regards,

zi
Logged

“Internet Explorer’s CSS rendering: WYSIWTF”. — someone genius
--------------------------------------------------
element
Jr. Member
*
Posts: 5



WWW
« Reply #2 on: Jun 01, 2005, 11:27 AM »

I think this is a much needed plugin, thanks!  I'm courious though on what effect do the ie hack for the png alpha transparency have on the validation of the page as far xhtml and css compliance, I saw that hack a long time ago but can't remember exactly how it's done any more. 

Thanks for the great plugin!  Regardless there is a couple of sites that will make good use this  Grin
Logged

"Don't ask why or wither, just enjoy the icecream while it's on your plate." - Oscar Wild

"Stuff and nonsense for this valley to the next." - Zen Saying
Lammikko
Full Member
***
Posts: 157



WWW
« Reply #3 on: Jun 01, 2005, 12:36 PM »

Thank you very, very much!
Logged

rthrash
Foundation
*
Posts: 9,514



WWW
« Reply #4 on: Jun 01, 2005, 05:37 PM »

Quote
I think this is a much needed plugin, thanks!  I'm courious though on what effect do the ie hack for the png alpha transparency have on the validation of the page as far xhtml and css compliance, I saw that hack a long time ago but can't remember exactly how it's done any more. 

I don't think it negatively affects validation, FWIW. Also, any other ideas for a "compatibility kit" for Win IE less than the upcoming version 7.0. Hover:anything comes to mind for me...
Logged

MODx is a framework that allows web professionals to turn over sites to end-users for daily maintenance without worrying. Community participation and questions are encouraged, especially when you help us help you, read the wiki, and review snippet parameters – even if you have to look at the source. Searching the forums helps, too.
Ryan Thrash
MODx Co-Founder
Principal @ Collabpad
work productively.
work intelligently.
work together.
xwisdom
Foundation
*
Posts: 1,732



« Reply #5 on: Jun 01, 2005, 10:42 PM »

? I'm courious though on what effect do the ie hack for the png alpha transparency have on the validation of the page as far xhtml and css compliance

Hi,

Thanks to all for the feedback. I don't see where this plugin should have any effect on xhtml and css. How it works is that it will only replace the "src" values for the necessary tags only when the IE browser is detected. So it should not change anything for FF, opera or any other browser.

Best regards,
Logged

xWisdom
www.xwisdomhtml.com
The fear of the Lord is the beginning of wisdom:
MODx Co-Founder - Create and do more with less.
Dimmy
Testers
*
Posts: 1,818


Я не говорю по-русски 私は日本語を話さない


WWW
« Reply #6 on: Jul 14, 2005, 05:05 AM »

OK found a little bug with this cool plugin

the plugin needs image dimentions to work or els the spacer.png wil be 0 pixels and that way wil it not show the image.

I used the img TV to set a png but that resulted in the png file not showing and the source looked like this:

Code:
<img src='assets/images/spacer.png' style="width: 0; height: 0; filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src='http://www.elisabethschaap.nl/assets/images/header/header_img_nl.png', sizingMethod=);" /

then I changed the TV to a richeditor one and placed an png with that and it works fine. The source of the page rederd this way is:
Code:
<img src="assets/images/spacer.png" style="width: 610px; height: 124px; filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src='http://www.elisabethschaap.nl/assets/images/header/header_img_nl.png', sizingMethod=);" alt=""/>

see the difference?

This: style="width: 0; height: 0; (image not showing)
or this: style="width: 610px; height: 124px (image showing)

Greets Dimmy
« Last Edit: Jul 14, 2005, 05:07 AM by Dimmy » Logged

"They say if you play a Microsoft CD backwards, you hear satanic messages. That's nothing, because if you play it forwards, it installs Windows."
Nederlands beste portal voor pda en mobiel internet
xwisdom
Foundation
*
Posts: 1,732



« Reply #7 on: Jul 14, 2005, 12:37 PM »

Hi Dimmy,

 I think the reason is because the Image TV does not set the width and height of the image. You can continue to use the RichText editor for the time being.

TP3 will include an Image Widget which will allow you to set the Width and height of the image.
Logged

xWisdom
www.xwisdomhtml.com
The fear of the Lord is the beginning of wisdom:
MODx Co-Founder - Create and do more with less.
SpeedStreet
Full Member
***
Posts: 151


WWW
« Reply #8 on: Jul 14, 2005, 07:11 PM »

Hi Dimmy,

 I think the reason is because the Image TV does not set the width and height of the image. You can continue to use the RichText editor for the time being.

TP3 will include an Image Widget which will allow you to set the Width and height of the image.

X,

I don't know if this will help, but I tried using a bunch of different hacks to make PNGs work for me, and the one that works the best is the one at: http://homepage.ntlworld.com/bobosola/

FWIW, please everyone keep in mind that IE7 will support PNG transparency. 
Logged

John Vilsack
aka SpeedStreet
Bravado
Coding Team
*
Posts: 1,078


"I can learn to resist anything but temptation..."


WWW
« Reply #9 on: Jul 15, 2005, 11:58 AM »

Well...I'll put my two cents in....

I think one thing everyone should realize is that the support for PNG alpha transparency is still not quite where it needs to be yet.  Granted, the support is there for many browsers and with some hacks it can be implemented.  But relying on it and designing a site around it might not be such a good thing yet.  I always do everything in terms of the "lowest common denominator". 

For example, when it comes to screen resolutions, 800x600 is about the lowest common denominator with 1024x768 quickly becoming the norms.  Now, this assumes that you're targetting the widest audience.  If you know that the majority is using higher screen resolutions then 1024x768 might be your target resolution.

Another example would be which revision of CSS to use.  Obviously, CSS 3 isn't really an option right now.  But you might want some CSS 2 stuff.  So developing your style sheets to degrade properly would definitely need to be addressed.

The point is that if you use PNG alpha transparencies, you'll need to think about how it'll degrade on browser that don't support transparencies or PNG's for that matter.  I certainly wouldn't like to visit a site and see a nasty grey box around an image.  I guess it just really depends on how you plan to use them and what your target audience will be. 

Just some food for thought.  Smiley

Jeff
Logged

Jeff Whitfield

"When someone asks you, A penny for your thoughts, and you put your two cents in, what happens to the other penny?"

-George Carlin
rthrash
Foundation
*
Posts: 9,514



WWW
« Reply #10 on: Jul 15, 2005, 12:11 PM »

Agreed Jeff. I pretty much target IE 5.5+, Safari and Firefox now, with a smattering of Opera thrown in here and there. The other browsers just don't merit attention at this point for the amount of work required to support them (and the installed base compared tothe benefits it would bring to clients).

Regardless when they're deployed, they will all degrade acceptably so all the content will be accessible.
Logged

MODx is a framework that allows web professionals to turn over sites to end-users for daily maintenance without worrying. Community participation and questions are encouraged, especially when you help us help you, read the wiki, and review snippet parameters – even if you have to look at the source. Searching the forums helps, too.
Ryan Thrash
MODx Co-Founder
Principal @ Collabpad
work productively.
work intelligently.
work together.
SpeedStreet
Full Member
***
Posts: 151


WWW
« Reply #11 on: Jul 15, 2005, 01:10 PM »

Agreed Jeff. I pretty much target IE 5.5+, Safari and Firefox now, with a smattering of Opera thrown in here and there. The other browsers just don't merit attention at this point for the amount of work required to support them (and the installed base compared tothe benefits it would bring to clients).

Regardless when they're deployed, they will all degrade acceptably so all the content will be accessible.

In my designs, I would concur with this philosophy.  5.5+
Logged

John Vilsack
aka SpeedStreet
gilbertn
Jr. Member
*
Posts: 10


I love MODx!


« Reply #12 on: Feb 25, 2006, 10:51 PM »

Have you guys seen Dean Edwards' "IE7 Compatibility Script"?  It does a fantastic job of making IE6 behave like a vaguely standards-compliant browser  - I gather that even Microsoft themselves were using it in the early stages of building IE7 - squashing a lot of the worst layout bugs and adding support for transparent pngs too (as long as one names the files according to his convention: "foo.png" should be called "foo-trans.png" as I recall).

I include it by default in anything I do.

Check it out at http://dean.edwards.name/IE7/

Edit:
You can amend Dean's code so that it'll give alpha transparency to any png, however named.  I assume that he made it non-default behaviour to reduce the rendering overhead, but since I don't usually include that much heavy graphical content, I tend to do this just so as not to have to rename files.
« Last Edit: Feb 26, 2006, 07:25 AM by gilbertn » Logged
Dimmy
Testers
*
Posts: 1,818


Я не говорю по-русски 私は日本語を話さない


WWW
« Reply #13 on: Feb 26, 2006, 02:58 AM »

Have you guys seen Dean Edwards' "IE7 Compatibility Script"?  It does a fantastic job of making IE6 behave like a vaguely standards-compliant browser  - I gather that even Microsoft themselves were using it in the early stages of building IE7 - squashing a lot of the worst layout bugs and adding support for transparent pngs too (as long as one names the files according to his convention: "foo.png" should be called "foo-trans.png" as I recall).

I include it by default in anything I do.

Check it out at http://dean.edwards.name/IE7/

Nice

Would be great to have this as a plug-in
Logged

"They say if you play a Microsoft CD backwards, you hear satanic messages. That's nothing, because if you play it forwards, it installs Windows."
Nederlands beste portal voor pda en mobiel internet
gilbertn
Jr. Member
*
Posts: 10


I love MODx!


« Reply #14 on: Feb 26, 2006, 07:56 AM »

Would be great to have this as a plug-in

Maybe as a default include?

I'd suggest so simply because
1) it obviates the need for the usual mountain of hacks for IE6
2) It can be included on demand with conditional commments, so no redundant load / rendering

The point is really about marketing the backwards / forwards compatibility of MODx: you guys have done such an amazing job of separating code from mark-up and style that porting css-driven layouts is a snap.  If an out-of-the-box implementation  takes care of the legacy nightmare, it's easier still, and therefore that much more appealing to new adopters.

This is a more pressing issue than ever before in the face of IE7.  MS are frantically trying to stop people from using css hacks, since switching the stylesheet to a specialised one that will resolve IE6 bugs will make the page render peculiarly in IE7, as they seem to have gone to some trouble to do a better job of complying to standards (not that it comes anywhere close to passing Acid Test 2!).
Logged
Pages: [1] 2 3 ... 5   Go Up
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP

Copyright © 2005-2008 MODxCMS, All rights reserved. Contact Us
Styles by ziworks.com

Powered by SMF 1.1.4 | SMF © 2005, Simple Machines LLC

Valid XHTML 1.0! Valid CSS!