PHP code example of signpostmarv / php-ico

1. Go to this page and download the library: Download signpostmarv/php-ico library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

signpostmarv / php-ico example snippets




$source = dirname( __FILE__ ) . '/example.gif';
$destination = dirname( __FILE__ ) . '/example.ico';

$ico_lib = new PHP_ICO( $source );
$ico_lib->save_ico( $destination );



$source = dirname( __FILE__ ) . '/example.gif';
$destination = dirname( __FILE__ ) . '/example.ico';

$ico_lib = new PHP_ICO( $source, array( array( 32, 32 ), array( 64, 64 ) ) );
$ico_lib->save_ico( $destination );



$destination = dirname( __FILE__ ) . '/example.ico';

$ico_lib = new PHP_ICO();

$ico_lib->add_image( dirname( __FILE__ ) . '/example-small.gif', array( array( 16, 16 ), array( 24, 24 ), array( 32, 32 ) ) );
$ico_lib->add_image( dirname( __FILE__ ) . '/example-medium.gif', array( array( 48, 48 ), array( 96, 96 ) ) );
$ico_lib->add_image( dirname( __FILE__ ) . '/example-large.gif', array( array( 128, 128 ) ) );

$ico_lib->save_ico( $destination );



$source = dirname( __FILE__ ) . '/example.gif';
$destination = dirname( __FILE__ ) . '/example.ico';

$sizes = array(
	array( 16, 16 ),
	array( 24, 24 ),
	array( 32, 32 ),
	array( 48, 48 ),
);

$ico_lib = new PHP_ICO( $source, $sizes );
$ico_lib->save_ico( $destination );