Jump to content


Photo

newbie project: random favicon?


  • Please log in to reply
No replies to this topic

#1 tefflox

tefflox
  • New Members
  • Pip
  • Newbie
  • 4 posts

Posted 26 June 2006 - 01:03 AM

the idea is to make an elliptical favicon of random color that is new for each page load. here's what i've got so far. the page / source is http://listenlight.n...epng.php<br />
What am I missing?

<?php
function randomFavicon() {
          $img = imagecreatetruecolor(16, 16); /* Create a blank image */
          $bgc = imagecolorallocate($img, rand(1,160), rand(1,160),rand(1,160));
          $ec  = imagecolorallocate($img, rand(1,160), rand(1,160),rand(1,160));
          imagefilledellipse($img, 8, 8, 12, 16, $ec);
          //header("Content-type: image/png");
          imagepng($img);
          
          return $img;
         }      
?>
<?php
$favipng = randomFavicon();

  echo( "<link rel=\"icon\" href=\"".$favipng."\" type=\"image/x-icon\" /><br /><link rel=\"shortcut icon\" href=\"".$favipng."\" type=\"image/x-icon\" /><br />"); 

  echo ( "<title> testing </title>" );
?>





0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users