PHP code example of teddy / imgtodataurl

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

    

teddy / imgtodataurl example snippets


$file = new \SplFileInfo(__DIR__ . '/css/test.css');
$imgToDataUrl = new Teddy\ImgToDataUrl();
$imgToDataUrl->setCssFromFile($file);
$imgToDataUrl->setMaxSize(10); // convert only images with size <= 10 KB; (default = 3)
echo $imgToDataUrl->convert();