PHP code example of koren / inline-images

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

    

koren / inline-images example snippets




$inliner = new InlineImages\Converter('/path/to/img.png');

echo '<img src="'.$inliner->convert().'"/>';
//or for css
echo 'background: url('.$inliner->convert().')';




$inliner = new InlineImages\Converter('http://path/to/img.png');

echo '<img src="'.$inliner->convert().'"/>';
//or for css
echo 'background: url('.$inliner->convert().')';




$inliner = new InlineImages\Converter('/path/to/img.svg');

echo '<img src="'.$inliner->convert().'"/>';
//or for css
echo 'background: url('.$inliner->convert().')';