trying to make random favicons

Ye' old general discussion board. Basically, for everything that isn't covered elsewhere. Come here to shoot the breeze, shoot your mouth off, or whatever suits your fancy.
This forum is not for asking programming related questions.

Moderator: General Moderators

Post Reply
tefflox
Forum Newbie
Posts: 1
Joined: Sun Jun 25, 2006 12:55 am

trying to make random favicons

Post by tefflox »

I'm new to web development. You can see the extent of my php experience at http://listenlight.net/hello.php

Now I'm trying to make random favicons. Here is what I've got so far..

Code: Select all

<?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));
       if( imagefilledellipse($img, 8, 8, 12, 16, $ec) ) {
         header("Content-type: image/png");
         imagepng($img);
         return $img;
        } else ??
                 
?>
if I can get that to work, then I have to figure out how the link works. What to do?
User avatar
kendall
Forum Regular
Posts: 852
Joined: Tue Jul 30, 2002 10:21 am
Location: Trinidad, West Indies
Contact:

Post by kendall »

LOL....dude,

first off that aint "favicons" so u "mite" have a hard time getting them to display...

secondly try http://www.chami.com/html-kit/services/favicon/
User avatar
RobertGonzalez
Site Administrator
Posts: 14293
Joined: Tue Sep 09, 2003 6:04 pm
Location: Fremont, CA, USA

Post by RobertGonzalez »

Why not just create a default image and set a return variable with the value of the default. Work the function and if everything works, then set the return variable to the value of the random favicon. If it doesn't work, well you have already set a default so that will be returned.
Post Reply