![]() |
vB Integration of "Normal display of PNG Alpha Transparency with MSIE" PHP script
File Edits: 2 (in one file)
New Files: 1 (forumroot/images/spacer.png) This script, for those that don't know it, is a server-side solution to the faulty display of 24-bit alpha transparencies in MSIE... For more info please read up on the site created by the d00d that wrote the script - all the props go to him! Created in response to my need to bloody well get it right after so many months, as well as https://vborg.vbsupport.ru/showthread.php?t=61091 and https://vborg.vbsupport.ru/showthread.php?t=66846... OK - now to get this integrated to your vB so that any PNG24 images with transparency will display without that ugly grey backdrop in MSIE, please do the following: In includes/functions.php: Find: PHP Code:
PHP Code:
PHP Code:
PHP Code:
PHP Code:
OK - now the only reason this will not work (except if you neglect to upload this excellent functions.php file) is if your calls to the PNG file of your choice does not have a full definition ... When I say work - your forum will still work no probs, it's just the script will pass over each PNG tag like the Angel of Death over a blood-stained door if you don't fit the bill :D Will work: <img src="$vboptions[bburl]/images/misc/someimage.png" width="10" height="10" /> Will not work: <img src="$vboptions[bburl]/images/misc/someimage.png" /> Will work: <img src="clear.gif" style="background-image:url($vboptions[bburl]/images/misc/someimage.png);height:10px;width:10px" /> Will not work: <img src="clear.gif" style="background-image:url($vboptions[bburl]/images/misc/someimage.png)" /> Will work: <body style="background-image:url($vboptions[bburl]/images/misc/someimage.png)"> Read over his page if you want more info as I said :) Enjoy y'all :) ( and please remember to test this in IE - it will only make a difference if you use IE ;) ) I've also attached for your own testing, the same image used in the test on the original author's site... Have fun kiddies :) May the PNG24 be with you ;) LOL - well that attachment of the spacer.png doesn't work ;D you need to be able to see the 1x1 attachment to click on it hehe... feel free to grab it from http://www.mobileforces.org/forums/images/spacer.png EDIT 26-08-2004: This links to a HOW-TO on using this with Avatars - it requires a small one-file, one-tempalte hack. EDIT: 07-01-2005 The function this is based on was updated a while back to NOT require the width and height to be explicitly defined, and so this has now been updated to include the latest version of this function. TO UPGRADE: Just replace: PHP Code:
PHP Code:
|
natch i did not understand what it does, my english is not very bad, but its not enogh to understand that ..
can you explain in in 1 sentende for me please? |
Look at this page using IE - then look at the same page using Mozilla or another pbrwser - you will see that the Image that is repeated on the page has a grey border where it should be transparent until the "fix" is applied...
This hack provides a way to apply that fix to your forum without having to hack each location where the PNG-24bit transparent images appear. If you want to know more about how mouch work it is, there is a style released on vBt that has this fix applied throuhgout it manually - the coder who wrote it would be able to explain how much more work it is. The reason to do this is because GIF transpararency is good, but the quality of a GIF is terrible unless the filesize if huge - PNG24 files can be tiny filesizes while being large images with HQ transparency and no loss in the compression. More than one sentence, but there you go. |
ahh okai i understand .. and are png images supported by vb3.0 to make thumbnails within the posting images in a thread?
|
This script will not pick them up even if this was the case - it's not magic, just detects .png file extensions in <img src tags or style="background: url() definitions
|
Natch, I got this to work, but not as I need.
It works: See this thread: http://www.onlinedebate.net/forums/s...1368#post41368 The problem I'm having, is that I need this to work with avatars. I add the width/height after the: [/b]<img src="$avatarurl"[/b], but it doesn't work. The complete line of code for the avatar is: PHP Code:
|
it should work when the info is in the template - can you check for me that you have made the alteration to the avatar in all postbit templates and in all avatar locations ?
You will definitely need to add either style="width:Npx;height:Mpx" or width="N" height="M" to all instances of the avatar: check that you have edited the postbit_legacy tempalte as well as postbit.... |
I only use the postbit_legacy template (I don't use the other...is it still required to code it even if that template is "disabled"?).
The width/height attributes are there as you can see in the code above. Are you saying that in all places where the avatar is coded, it must have these attributes even if those places are not active? |
try using style="width:Npx;height:Mpx" instead - let me knwo how you go...
|
This is what I tried:
PHP Code:
Do I have to have the closing style tag in there? |
Nope - it's not a tag thing when you have inline styles ...
One option (and I don't know if this will work) is to have some additional code added to the part of showthread that grabs the avatar that will give you the width and height statement ... I'll look into it man... |
OK - a solution to this is a separate hack:
In includes/functions_showthread.php: Find: PHP Code:
PHP Code:
Find: Code:
<img src="$avatarurl" Code:
<if condition="$avatarimgsrc">$avatarimgsrc </if> Code:
$avatarimgsrc = "style="width:$avatarbits[0]px;height:$avatarbits[1]px" |
the includes/functions_showthread.php edit resulted in:
Quote:
Quote:
|
Undo that edit, then point me to your site: I'll take a lok at what your site generates as $avatarurl and then get more info for you.
NOTE: this last bit of this hack is not something that is a part of the original a new hack as I said - so I'm not sure how far I can support PNG avatars... unless you switch your Avatars to store them in the filesystem, as opposed to the database - that might make a difference. |
I undid it. My site: www.onlinedebate.net/forums
Now, perhaps something of interest. I have vbadvanced CMPS. The avatar displayed w/ a transparent background with CMPS (block in the upper right hand corner). It was when I went to the forums, that all hell broke loose. |
Question: do you store your avatars in the database or the filesystem?
|
This will work within templates, right?
|
Quote:
|
Can you paste in here the code you have used ?
Remember you need to specify a height and width for the image. |
he has a new version of his script up that does not require dimensions
|
Nach, they are currently stored in the database. Should I change that?
|
I'll be re-releasing this to include the new script which works without needing the height and widht... been too busy the last little while to do anything about it - you could try putting them into the filesystem - see how you go.
|
Quote:
...well, except for wiping my logo out on vBaCMPS. :) |
Well the only thing you would need to do is make sure you place the path back in to the spacer.png
|
Quote:
|
Quote:
:( |
The path - you should use a full path, or use the $_SERVER['DOCUMENT_ROOT'] superglobal to prefix your path to your spacer.png...
|
I am using exactly the same block of text (the function) in both includes/functions.php .. on one site (the totally new one) it works marvellously.
On the other (my existing site), on the index.php, there is nothing visible above the navbar. On checking the source, I get almost exactly the same thing on both, except on the one with no logo on index.php, the logo section looks like this: PHP Code:
|
well it looks like you are using forums. format in the same situation as /forums/ - you need some consistency here ;)
Suggest you change the path to / from /forums/... |
Yeah, it's on a subdomain really, the new one hasn't had that set up yet...maybe that is it.
|
Looking forward to adding this to my site, though a friend pointed me at another solution that I thought I would share. Not sure how easy/hard this would be to use with vBulletin is all.
Check out http://www.mongus.net/pngInfo/ |
This has been updated today to include the latest version of this function: now no longer requires the width / height to be explicitly defined for it to pck up on the PNG images and make modifications if required.
|
Let me be the first to thank you for the update. I'll try to see where i was wrong.
Thank you ;) |
Well, i've tested this new version, and it doesn't work for me... And it slows down my website on IE... So it've put your "old" hack.
|
Neither version works for me, using 3.0.6.. :(
|
I followed this exactly... but when a page is viwed with my png quotes on it i get
Warning: getimagesize(): Read error! in /includes/functions.php on line 4013 Warning: getimagesize(): Read error! in /includes/functions.php on line 4013 Warning: getimagesize(): Read error! in /includes/functions.php on line 4013 at the top of the page and none of the png's show.... any clues??? |
I understand ! Natch has updated his first version of his hack.
Here is the old one : Code:
// PNG-24 Alpha Transparency with MSIE |
Thanx that worked a treat!!!!
Only i have png images in the postbit under the username and the grey area still shows on those?? |
Well. I could not get pngs with transparent alpha layers to show properly as a background image. The hack worked great for regular images. So...I finally upgraded to the new version. And you know what? Still doesn't work with background images...and now if a png image doesn't have height and width it just doesn't display in IE for windows. It's odd...cause before, it would just show the grey background, but now the image disapears altogether.
|
Justin Koivisto released the 25 february 2005 the 2.06 version of his script and guess what... It works :-) Except that the width and height still must be precised otherwise no image appears.
The new code is joined in the attache text file. |
All times are GMT. The time now is 04:44 PM. |
Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
![]() |
|
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|