DomPDF: Image not readable or empty

Following helped me like charm, at least localy, and even with

define("DOMPDF_ENABLE_REMOTE", false);

The solution is to change the image SRC to the absolute path on the server, like this:

<img src="/var/www/domain/images/myimage.jpg" />

All of the following worked for me:

<img src="<?php echo $_SERVER["DOCUMENT_ROOT"].'/placeholder.jpg';?>"/>
<img src="<?php echo $_SERVER["DOCUMENT_ROOT"].'\placeholder.jpg';?>"/>
<img src="<?php echo $_SERVER["DOCUMENT_ROOT"].'./placeholder.jpg';?>"/>

$_SERVER["DOCUMENT_ROOT"] is C:/wamp/www/ZendSkeletonApplication/public

Thanks to this: lost in code


As there was another answer that suggests enabling the remote option in module.config.php and I can't yet add comments, I thought it would be best to answer that this file does not exist in newer versions of DomPDF.

If you need to include remotely stored images in a newer version you have to pass it as an option to the constructor:

$dompdf = new Dompdf(array('enable_remote' => true));

This fixed the issue I had.