Grazie mille sei stato gentilissimo e va perfettamente,
Mi chiedevo, nel codice incollato di seguito:
if(!function_exists("generate_favicon")){function generate_favicon(){
// Create favicon.
$postvars = array(
"image" => trim($_FILES["image"]["name"]),
"image_tmp" => $_FILES["image"]["tmp_name"],
"image_size" => (int)$_FILES["image"],
"image_dimensions" => (int)$_POST["image_dimensions"]);
$valid_exts = array("jpg","jpeg","gif","png");
$explode = explode(".",strtolower(trim($_FILES["image"]["name"])));
$ext = end($explode);
$directory = "./favicon/"; // Directory to save favicons. Include trailing slash.
$rand = rand(1000,9999);
$filename = $rand.$postvars["image"];
// Check not larger than 175kb.
if($postvars["image_size"] <= 179200){
// 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,100) or die('Could not make image file');
if(file_exists($directory.$filename)){
// Image created, now rename it to its
$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 '<br/><br/>
Favicon successfully generated. <img src="'.$directory.$strip_ext.'.ico" border="0" title="Favicon Image Preview" style="background-color:#e0e0e0" /> <a href="'.$directory.$strip_ext.'.ico" target="_blank" name="Download favicon.ico now!">Click here to download.</a>';
} else {
"File was 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 "File size too large. Max allowed file size is 175kb.";
}
} else {
return "Invalid file type. You must upload an image file. (jpg, jpeg, gif, png).";
}
}
}
Crea la favicon nelle misure 16 e 32 px come potrei dare la grandezza più grande? Tipo 64x64 ecc ? Dove devo agire?