Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

images not working #7

Closed
mrpootoo opened this issue Dec 6, 2012 · 2 comments
Closed

images not working #7

mrpootoo opened this issue Dec 6, 2012 · 2 comments

Comments

@mrpootoo
Copy link

mrpootoo commented Dec 6, 2012

This works
<div style="background-image: url('/images/obama-family.jpg');">

oddly, this does not
<img src="/images/obama-family.jpg" >

however, this does (but of course makes it more difficult to view the html)
<img src="/absolute/path/to/images/obama-family.jpg" >

have tried

$dompdf = new DOMPDF();
$dompdf->set_base_path('/absolute/path/to/');
etc;

without success

This is with CPDF or PDFLib. - 0.6.0 Beta 3

@bsweeney
Copy link
Member

bsweeney commented Dec 6, 2012

Odd. dompdf should parse the path for the CSS background URL and the HTML image source the same. Is this HTML retrieved via a web server ($dompdf->load_html_file('http://example.com/docs/sample.html');) or via the file system ($dompdf->load_html_file('docs/sample.html');) or generated and fed to dompdf ($dompdf->load_html($html);)?

@mrpootoo
Copy link
Author

mrpootoo commented Dec 6, 2012

$dompdf->load_html($html);

Javdu10 added a commit to Javdu10/dompdf that referenced this issue Oct 20, 2021
…owed path(s)

Hello!

So I had a weird error in my Laravel project using the libs `dompdf/dompdf`, `barryvdh/laravel-dompdf` and `laraveldaily/laravel-invoices` 

The function `Dompdf\\Cpdf->openFont()` were called with an empty $font, it was on shared hosting with open_basedir restrictions.

Here is the full stacktrace: 

```
[2021-10-20 20:23:47] production.INFO: FONT LOADED: /httpdocs/plugins/invoicepro/vendor/dompdf/dompdf/lib/fonts/Helvetica  
[2021-10-20 20:23:47] production.INFO: FONT LOADED: /httpdocs/plugins/invoicepro/vendor/dompdf/dompdf/lib/fonts/DejaVuSans  
[2021-10-20 20:23:47] production.INFO: FONT LOADED: /httpdocs/plugins/invoicepro/vendor/dompdf/dompdf/lib/fonts/Times-Bold  
[2021-10-20 20:23:47] production.INFO: FONT LOADED: /httpdocs/plugins/invoicepro/vendor/dompdf/dompdf/lib/fonts/DejaVuSans-Bold  
[2021-10-20 20:23:47] production.INFO: FONT LOADED:   
[2021-10-20 20:23:47] production.ERROR: file_exists(): open_basedir restriction in effect. File(/.ufm) is not within the allowed path(s): (/:/tmp/) {"userId":1,"exception":"[object] (ErrorException(code: 0): file_exists(): open_basedir restriction in effect. File(/.ufm) is not within the allowed path(s): (/:/tmp/) at /httpdocs/plugins/invoicepro/vendor/dompdf/dompdf/lib/Cpdf.php:3341)
[stacktrace]
#0 [internal function]: Illuminate\\Foundation\\Bootstrap\\HandleExceptions->handleError()
dompdf#1 /httpdocs/plugins/invoicepro/vendor/dompdf/dompdf/lib/Cpdf.php(3341): file_exists()
dompdf#2 /httpdocs/plugins/invoicepro/vendor/dompdf/dompdf/lib/Cpdf.php(3549): Dompdf\\Cpdf->openFont()
dompdf#3 /httpdocs/plugins/invoicepro/vendor/dompdf/dompdf/src/Adapter/CPDF.php(1030): Dompdf\\Cpdf->selectFont()
dompdf#4 /httpdocs/plugins/invoicepro/vendor/dompdf/dompdf/src/FontMetrics.php(327): Dompdf\\Adapter\\CPDF->get_text_width()
dompdf#5 /httpdocs/plugins/invoicepro/vendor/dompdf/dompdf/src/FontMetrics.php(294): Dompdf\\FontMetrics->getTextWidth()
dompdf#6 /httpdocs/plugins/invoicepro/vendor/dompdf/dompdf/src/PhpEvaluator.php(53) : eval()'d code(6): Dompdf\\FontMetrics->get_text_width()
dompdf#7 /httpdocs/plugins/invoicepro/vendor/dompdf/dompdf/src/PhpEvaluator.php(53): eval()
dompdf#8 /httpdocs/plugins/invoicepro/vendor/dompdf/dompdf/src/PhpEvaluator.php(61): Dompdf\\PhpEvaluator->evaluate()
dompdf#9 /httpdocs/plugins/invoicepro/vendor/dompdf/dompdf/src/Renderer.php(293): Dompdf\\PhpEvaluator->render()
dompdf#10 /httpdocs/plugins/invoicepro/vendor/dompdf/dompdf/src/Renderer.php(138): Dompdf\\Renderer->_render_frame()
dompdf#11 /httpdocs/plugins/invoicepro/vendor/dompdf/dompdf/src/Renderer.php(194): Dompdf\\Renderer->render()
dompdf#12 /httpdocs/plugins/invoicepro/vendor/dompdf/dompdf/src/FrameReflower/Page.php(148): Dompdf\\Renderer->render()
dompdf#13 /httpdocs/plugins/invoicepro/vendor/dompdf/dompdf/src/FrameDecorator/AbstractFrameDecorator.php(895): Dompdf\\FrameReflower\\Page->reflow()
dompdf#14 /httpdocs/plugins/invoicepro/vendor/dompdf/dompdf/src/Dompdf.php(838): Dompdf\\FrameDecorator\\AbstractFrameDecorator->reflow()
dompdf#15 /httpdocs/plugins/invoicepro/vendor/barryvdh/laravel-dompdf/src/PDF.php(208): Dompdf\\Dompdf->render()
dompdf#16 /httpdocs/plugins/invoicepro/vendor/barryvdh/laravel-dompdf/src/PDF.php(155): Barryvdh\\DomPDF\\PDF->render()
```

The `FONT LOADED` part was to log the current font and was placed just above where the error was at `Cpdf.php(3341)`
Javdu10 added a commit to Javdu10/dompdf that referenced this issue Oct 31, 2021
…owed path(s)

Hello!

So I had a weird error in my Laravel project using the libs `dompdf/dompdf`, `barryvdh/laravel-dompdf` and `laraveldaily/laravel-invoices` 

The function `Dompdf\\Cpdf->openFont()` were called with an empty $font, it was on shared hosting with open_basedir restrictions.

Here is the full stacktrace: 

```
[2021-10-20 20:23:47] production.INFO: FONT LOADED: /httpdocs/plugins/invoicepro/vendor/dompdf/dompdf/lib/fonts/Helvetica  
[2021-10-20 20:23:47] production.INFO: FONT LOADED: /httpdocs/plugins/invoicepro/vendor/dompdf/dompdf/lib/fonts/DejaVuSans  
[2021-10-20 20:23:47] production.INFO: FONT LOADED: /httpdocs/plugins/invoicepro/vendor/dompdf/dompdf/lib/fonts/Times-Bold  
[2021-10-20 20:23:47] production.INFO: FONT LOADED: /httpdocs/plugins/invoicepro/vendor/dompdf/dompdf/lib/fonts/DejaVuSans-Bold  
[2021-10-20 20:23:47] production.INFO: FONT LOADED:   
[2021-10-20 20:23:47] production.ERROR: file_exists(): open_basedir restriction in effect. File(/.ufm) is not within the allowed path(s): (/:/tmp/) {"userId":1,"exception":"[object] (ErrorException(code: 0): file_exists(): open_basedir restriction in effect. File(/.ufm) is not within the allowed path(s): (/:/tmp/) at /httpdocs/plugins/invoicepro/vendor/dompdf/dompdf/lib/Cpdf.php:3341)
[stacktrace]
#0 [internal function]: Illuminate\\Foundation\\Bootstrap\\HandleExceptions->handleError()
dompdf#1 /httpdocs/plugins/invoicepro/vendor/dompdf/dompdf/lib/Cpdf.php(3341): file_exists()
dompdf#2 /httpdocs/plugins/invoicepro/vendor/dompdf/dompdf/lib/Cpdf.php(3549): Dompdf\\Cpdf->openFont()
dompdf#3 /httpdocs/plugins/invoicepro/vendor/dompdf/dompdf/src/Adapter/CPDF.php(1030): Dompdf\\Cpdf->selectFont()
dompdf#4 /httpdocs/plugins/invoicepro/vendor/dompdf/dompdf/src/FontMetrics.php(327): Dompdf\\Adapter\\CPDF->get_text_width()
dompdf#5 /httpdocs/plugins/invoicepro/vendor/dompdf/dompdf/src/FontMetrics.php(294): Dompdf\\FontMetrics->getTextWidth()
dompdf#6 /httpdocs/plugins/invoicepro/vendor/dompdf/dompdf/src/PhpEvaluator.php(53) : eval()'d code(6): Dompdf\\FontMetrics->get_text_width()
dompdf#7 /httpdocs/plugins/invoicepro/vendor/dompdf/dompdf/src/PhpEvaluator.php(53): eval()
dompdf#8 /httpdocs/plugins/invoicepro/vendor/dompdf/dompdf/src/PhpEvaluator.php(61): Dompdf\\PhpEvaluator->evaluate()
dompdf#9 /httpdocs/plugins/invoicepro/vendor/dompdf/dompdf/src/Renderer.php(293): Dompdf\\PhpEvaluator->render()
dompdf#10 /httpdocs/plugins/invoicepro/vendor/dompdf/dompdf/src/Renderer.php(138): Dompdf\\Renderer->_render_frame()
dompdf#11 /httpdocs/plugins/invoicepro/vendor/dompdf/dompdf/src/Renderer.php(194): Dompdf\\Renderer->render()
dompdf#12 /httpdocs/plugins/invoicepro/vendor/dompdf/dompdf/src/FrameReflower/Page.php(148): Dompdf\\Renderer->render()
dompdf#13 /httpdocs/plugins/invoicepro/vendor/dompdf/dompdf/src/FrameDecorator/AbstractFrameDecorator.php(895): Dompdf\\FrameReflower\\Page->reflow()
dompdf#14 /httpdocs/plugins/invoicepro/vendor/dompdf/dompdf/src/Dompdf.php(838): Dompdf\\FrameDecorator\\AbstractFrameDecorator->reflow()
dompdf#15 /httpdocs/plugins/invoicepro/vendor/barryvdh/laravel-dompdf/src/PDF.php(208): Dompdf\\Dompdf->render()
dompdf#16 /httpdocs/plugins/invoicepro/vendor/barryvdh/laravel-dompdf/src/PDF.php(155): Barryvdh\\DomPDF\\PDF->render()
```

The `FONT LOADED` part was to log the current font and was placed just above where the error was at `Cpdf.php(3341)`
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants