A PHP lib to handle image inlining in your (css, img src, etc.)
composer require milanspv/php-inline-images
<?php
// first way to initialize the object
$inliner = new InlineImages\Converter();
$inliner->setPath('/path/to/img.png');
// second way to initialize the object
$inliner = new InlineImages\Converter('/path/to/img.png');
// convert image
echo '<img src="'.$inliner->convert().'"/>';
//or for css
echo 'background: url('.$inliner->convert().')';
<?php
$inliner = new InlineImages\Converter('http://path/to/img.png');
echo '<img src="'.$inliner->convert().'"/>';
//or for css
echo 'background: url('.$inliner->convert().')';
<?php
$inliner = new InlineImages\Converter('/path/to/img.svg');
echo '<img src="'.$inliner->convert().'"/>';
//or for css
echo 'background: url('.$inliner->convert().')';