Help - Search - Members - Calendar
Full Version: Dynamic Sig File
Invision Power Services > Community Forums > Community Web Design and Coding
Avey
Hi

I was wondering if it would be possible to expand on the 'standard' dynamic sig scripts that have been made multiple times over. I want to use a series of images that contain transparency and would preferably like to use the PNG format. As IE (and others??) don't support transparent PNG images I was wondering if an alternate gif image could be used for those running that browser.

So it would be something like this:

IF Internet Explorer use GIF
ELSE use PNG

If anyone could help me out with this i would really appreciate it! biggrin.gif
Kenny Pollock
$agent = $_SERVER['HTTP_USER_AGENT'];
if(eregi("microsoft internet explorer", $agent)){
readfile("blah.gif");
} else {
readfile("blah.png");
}

might work.
Sebastian Mares
Except that you have to use "MSIE" as uer agent string AFAIK.
Avey
Thanks! original.gif

That works in IE, but when i test it in Opera and FF I get some pretty funky results.

See for yourself
_
Are you sure you send the headers? blink.gif
Sebastian Mares
Did you set the header to image/png?

CODE
Header('Content-type: image/png');


Edit: Veracon was faster. original.gif
Avey
Thanks guys, I reallly appreciate this help!! thumbsup.gif

At the moment it will only read the one file, how would I make it display a random image from a selection? Sorry for all the n00b questions. pinch.gif
Kenny Pollock
$images[] = '1.gif';
$images[] = 'blah.gif';
$images[] = '1454538tfh.gif';
srand ((double) microtime() * 1000000);
$random_number = rand(0,count($images)-1);
readfile($images[$random_number]);
Avey
Thanks Kenny, working perfectly. biggrin.gif
phatmonkey
There is also a function to pick a random key from an array. I can't remember what it is off the top of my head (array_rand()?).
Kenny Pollock
QUOTE(Avey @ Jun 15 2005, 04:17 AM) *
Thanks Kenny, working perfectly. biggrin.gif

No problem, glad I could help!
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2009 Invision Power Services, Inc.