Embedding images in a PDF file with PHP and DOMPDF

// A few settings
$image = 'cricci.jpg';

// Read image path, convert to base64 encoding
$imageData = base64_encode(file_get_contents($image));

// Format the image SRC:  data:{mime};base64,{data};
$src = 'data:'.mime_content_type($image).';base64,'.$imageData;

// Echo out a sample image
echo '<img src="',$src,'">';

This (corrected) code came from here

The above is all you actually need to know. By inlining images in the data-uri format, you can solve the basic problem of using DOMPDF to create self-contained PDFs with images that don't need to be loaded remotely.