• User Attivo

    Form immagine con estensione .ico

    Ciao, ho uno script che permette la creazione di favicon con estensione .ico solo nella grandezza 16x16px
    Come è possibile generarle anche nelle grandezze 32×32, 48×48, 64×64?

    Questa dovrebbe essere la parte che dovrebbe interessare, credo:

    $sessionhandler = new SessionSystem();$sessionhandler->SessionStart();
    
    
    		$post_size = ini_get('post_max_size');
    	    substr($post_size, -1);
    	    
    	    $post_size = $post_size * 1024;
    
    
    	    if (($_SERVER['CONTENT_LENGTH'] / 1024) > $post_size) $error = true;
    	    if(isset($error)){
    		    Messages::SetMessages('The image is larger the accepted MAX (2Mb)','error');
    			header('Location: index.php');
    	    }
    	    
    	    
    if(isset($_POST['submit']) && $_POST['submit'] == 1){
    
    
    		
    		if($_FILES['favicon']['error'] > 0){
    			Messages::SetMessages('Has not chosen any image','error');
    			header('Location: index.php');
    		}else{
    	    
    		$image_name = $_FILES['favicon']['name'];
    		$image_size = $_FILES['favicon'];
    		$temp = $_FILES['favicon']['tmp_name'];
    	
    		if(($image_size /1024) > 2048){
    			
    			Messages::SetMessages('The image is larger the accepted MAX (2Mb)','error');
    			header('Location: index.php');
    			
    		}
    		$image = new Thumbnail();
    		$image->Image($temp);
    		$i_name = $image->getImagename();
    		$parts = explode(".",$i_name);
    		
    		
    		$dir = 'uploads';
    		
    		$final_image_name = $image->SetImageName(time().'.ico');
    		
    		$image->SetImageDir($dir.DIRECTORY_SEPARATOR.$final_image_name);
    				
    		$saved = $image->SaveImage(16, 16 ,$image->GetImageDir());
    		
    		$sessionhandler->SetSessionVar('favicon',$image->getImageName());
    		
    		Messages::SetMessages('Has been generated correctly favicon!','success');
    		header('Location: index.php');
    		}
    
    
    	
    
    }
    

    Grazie per il vostro sicuro aiuto,
    Marco