phpbar.de logo

Mailinglisten-Archive

[php] 1x1 Pixel, transparentes GIF/PNG

[php] 1x1 Pixel, transparentes GIF/PNG

Achim Ruhland webmaster_(at)_achim-online.de
Sun, 23 Jul 2000 14:08:35 +0200


Hallo!

Für solche Zwecke hab ich grade auf zend.com ein passendes Script gefunden,
welches sogar ohne die GD so was ausgeben kann, hier der Quelltext:

<?php

// Ulrich Babiak, Koeln 1999/11/30
// syntax: <img src="phpixel.php3"> for a transparent pixel
//     or: <img src="phpixel.php3?c=FFFF00"> for a yellow pixel
// (color added by Thomas Schüßler, Bonn 2000/7/2)

Header( "Content-type:  image/gif");
Header( "Expires: Wed, 11 Nov 1998 11:11:11 GMT");
Header( "Cache-Control: no-cache");
Header( "Cache-Control: must-revalidate");

// if # is in front of the hex-string
$rgb = str_replace("#", "", $c);

$r = hexdec(substr ($rgb, 0,2));
$g = hexdec(substr ($rgb, 2,2));
$b = hexdec(substr ($rgb, 4,2));

if($c){ 
printf ("%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c", 
71,73,70,56,57,97,1,0,1,0,128,0,0,$r,$g,$b,0,0,0,44,0,0,0,0,1,0,1,0,0,2,2,68,1,0,59);  
} 
else{ 
printf ("%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%", 
71,73,70,56,57,97,1,0,1,0,128,255,0,192,192,192,0,0,0,33,249,4,1,0,0,0,0,44,0,0,0,0,1,0,1,0,0,2,2,68,1,0,59);  
} 

?>

Grüsse
Achim

-- 
A Webserver is like a Wigwam - No Windows, no Gates and Apache inside :)






php::bar PHP Wiki   -   Listenarchive