"; // Now actually generate it $im = imagecreatefromjpeg($target_path); list($width, $height) = getimagesize($target_path); // get the width and height of the jpg $image_p = imagecreatetruecolor("16", "16"); // create a 16x16 canvas to play with imagecopyresampled($image_p, $im, 0, 0, 0, 0, "16", "16", $width, $height); // resize jpg to 16x16 $num = rand (1,99999); // generate a random number between 1 and 99999 $output = $num."-favicon.ico"; // add the number to a string with -favicon.ico imagepng($image_p,$output); // make a .png file (icon file) from our data imagedestroy ($im); // close gd library echo "
Right click on the image and choose save. Save the image as favicon.ico and then upload into your base directory"; // show our icon with information unlink ($target_path); // delete the original file } } else{ echo "Upload a .jpg file to convert it to a favicon!"; } ?> Favicon Generator
Choose a file to upload: