PHP code example of splitbrain / php-ico
1. Go to this page and download the library: Download splitbrain/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/ */
splitbrain / php-ico example snippets
$source = __DIR__ . '/example.gif';
$destination = __DIR__ . '/example.ico';
$ico = new \splitbrain\phpico\PhpIco( $source );
$ico->save_ico( $destination );
$source = __DIR__ . '/example.gif';
$destination = __DIR__ . '/example.ico';
$ico = new \splitbrain\phpico\PhpIco( $source, [ [32, 32], [64, 64] ] );
$ico->save_ico( $destination );
$destination = dirname( __FILE__ ) . '/example.ico';
$ico = new \splitbrain\phpico\PhpIco();
$ico->add_image( __DIR__ . '/example-small.gif', [ [16, 16], [24, 24], [32, 32] ] );
$ico->add_image( __DIR__ . '/example-medium.gif', [ [48, 48], [96, 96] ] );
$ico->add_image( __DIR__ . '/example-large.gif', [ [128, 128] ] );
$ico->save_ico( $destination );
$source = __DIR__ . '/example.gif';
$destination = __DIR__ . '/example.ico';
$sizes = [
[ 16, 16 ],
[ 24, 24 ],
[ 32, 32 ],
[ 48, 48 ],
];
$ico = new \splitbrain\phpico\PhpIco( $source, $sizes );
$ico->save_ico( $destination );
composer