PHP code example of shopblocks / php-ico

1. Go to this page and download the library: Download shopblocks/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/ */

    

shopblocks / php-ico example snippets



$source = __DIR__ . '/example.gif';
$destination = __DIR__ . '/example.ico';
$converter = new Ossobuffo\PhpIco\IcoConverter($source);
$converter->saveIco($destination);


$source = __DIR__ . '/example.gif';
$destination = __DIR__ . '/example.ico';
$dimensions = [[16, 16], [24, 24], [32, 32], [64, 64]];
$converter = new Ossobuffo\PhpIco\IcoConverter($source, $dimensions);
$converter->saveIco($destination);


$destination = __DIR__ . '/example.ico';
$converter = new Ossobuffo\PhpIco\IcoConverter();

$converter->addImage(__DIR__ . '/example-small.gif', [[16, 16], [24, 24], [32, 32]]);
$converter->addImage(__DIR__ . '/example-medium.gif', [[48, 48], [64, 64]]);
$converter->addImage(__DIR__ . '/example-large.gif', [[128, 128]]);

$converter->saveIco($destination);