Dompdf: Image not found or type unknown for local images only after upgrading from 0.8.5 to 0.8.6

Created on 8 Oct 2020  路  3Comments  路  Source: dompdf/dompdf

Hi,

after upgrading from version 0.8.5 to version 0.8.6 my local images stopped working, showing message "Image not found or type unknown". Linking image from remote host works fine.

i use image like this:
<img src="images/logo.jpg" alt="logo"/>

i've also tried full path like this:
<img src="var/www/myproject/images/logo.jpg" alt="logo"/>

After downgrading dompdf back to 0.8.5 image is working again.

I have php , html5 parser and remote enabled:

$options = new Dompdf\Options();
$options->setIsPhpEnabled(true);
$options->setIsHtml5ParserEnabled(true);
$options->setIsRemoteEnabled(true);

Any suggestions what might be the reason for that? Im loading dompdf via composer.

question security

Most helpful comment

With 0.8.6 Dompdf honors the chroot restriction for resource references (images, external stylesheets). You should be able to address the issue by adding the following option:

$options->setChroot("/var/www/myproject");

All 3 comments

With 0.8.6 Dompdf honors the chroot restriction for resource references (images, external stylesheets). You should be able to address the issue by adding the following option:

$options->setChroot("/var/www/myproject");

Works like a charm! Thanks!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

halfer picture halfer  路  4Comments

enjibby picture enjibby  路  4Comments

UweKeim picture UweKeim  路  4Comments

AnarchyChampion picture AnarchyChampion  路  3Comments

nuez picture nuez  路  3Comments