When we do the Web system, each browser tab here will have an icon, this icon is called the Favicon icon, favicon.ico file placed in the root directory of the system
If the programmer does not have an ICO authoring tool, how do you generate the icon? can use the program to implement the build Ah! You can also cut the icon, choose Online generation, online generation test address: Www.vsoyo.com/ico
Below and everyone together under discussion, PHP generated ICO icon online production source, very simple principle, please see the following code
The following is the main code generated by the ICO icon Online
<?PHPif(!function_exists("Generate_favicon")){functionGenerate_favicon () {//Create favicon. $postvars=Array( "Image" =Trim($_files["Image"] ["Name"]), "image_tmp" =$_files["Image"] ["Tmp_name"], "image_size" = (int)$_files["Image"] ["Size"], "image_dimensions" = = (int)$_post["Image_dimensions"]); //provide valid extensions and Max file size $valid _exts=Array("JPG", "JPEG", "GIF", "PNG"); $max _file_size= 179200;//175kb $filenameParts=Explode(".",$postvars["Image"]); $ext=Strtolower(End($filenameParts)); $directory= "./favicon/";//Directory to save favicons. Include trailing slash. $rand=Rand(1000,9999); $filename=$rand.$postvars["Image"]; //Check not larger than max size. if($postvars["Image_size"] <=$max _file_size){ //Check is valid extension. if(In_array($ext,$valid _exts)){ if($ext= = "JPG" | |$ext= = "JPEG"){ $image= Imagecreatefromjpeg ($postvars["Image_tmp"]); } Else if($ext= = "GIF"){ $image= Imagecreatefromgif ($postvars["Image_tmp"]); } Else if($ext= = "png"){ $image= Imagecreatefrompng ($postvars["Image_tmp"]); } if($image){ List($width,$height) =getimagesize($postvars["Image_tmp"]); $newwidth=$postvars["Image_dimensions"]; $newheight=$postvars["Image_dimensions"]; $tmp= Imagecreatetruecolor ($newwidth,$newheight); //Copy the image to one with the new width and height.Imagecopyresampled ($tmp,$image, 0,0,0,0,$newwidth,$newheight,$width,$height); //Create image file with 100% quality. if(Is_dir($directory)){ if(is_writable($directory) {imagejpeg ($tmp,$directory.$filename,) or die(' Could not make image file '); if(file_exists($directory.$filename)){ //Image created, now rename it $ext _pos=Strpos($rand.$postvars["Image"], ".".$ext); $strip _ext=substr($rand.$postvars["Image"],0,$ext _pos); //Rename image to. ico file Rename($directory.$filename,$directory.$strip _ext.". Ico); return‘<strong> icon Preview:</strong><br/> ‘.$directory.$strip _ext.‘. ico "border=" 0 "title=" Favicon finished preview "style=" padding:4px 0px 4px 0px;background-color: #e0e0e0 "/><br/> Favicon/ico icon finished: <a href= "‘.$directory.$strip _ext.‘. ico "target=" _blank "name=" right click Save as Download! " > click/Right to save the download and rename it to "Favicon.ico" </a> "; } Else { "File is not created."; } } Else { return' The directory: '.$directory. ' is not writable. '; } } Else { return' The directory: '.$directory. ' is not valid. '; } Imagedestroy ($image); Imagedestroy ($tmp); } Else { return"Could not create image file."; } } Else { return"The icon is too large to exceed 175KB"; } } Else { return"The image format can only be in the following categories (JPG, JPEG, GIF, PNG)."; }}}?>
Friends who need further technical exchanges, please add me: 15889726201
ico icon online generation, PHP generated ico icon online production source