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

img is not displayed #586

Closed
mdevendr opened this issue Jan 22, 2013 · 3 comments
Closed

img is not displayed #586

mdevendr opened this issue Jan 22, 2013 · 3 comments

Comments

@mdevendr
Copy link

t.html content below,
<html>
<head>Testing PDF IMAGE</head>
<body>
<p> Trying all three access to see if the image loading works </p>
<img src='http://www.tindyto.com/images/logo.png' align='absmiddle' border='1'>
<img src='../../images/logo.png' align='absmiddle' border='1'>
<img src='/home/tindyt5/public_html/images/logo.png' align='absmiddle' border='1'>
</body>
</html>

$php dompdf.php t.html

Result PDF contains
Testing PDF IMAGE

and no image... Disappointing :(

ah! Yes, I tired all abra - cabra boom boom - setting DOMPDF_ENABLE_REMOTE=true, ensuring /tmp is accessible, creating /tmp dir under dompdf, etc...

PHP version
PHP 5.3.13 (cli) (built: Jun 21 2012 07:49:17)
Copyright (c) 1997-2012 The PHP Group
Zend Engine v2.3.0, Copyright (c) 1998-2012 Zend Technologies
with the ionCube PHP Loader v4.0.12, Copyright (c) 2002-2011, by ionCube Ltd., and
with Zend Guard Loader v3.3, Copyright (c) 1998-2010, by Zend Technologies

DOMPDF Version
DOMPDF 0.6.0 beta 3

Any help is appreciated

@bsweeney
Copy link
Member

So you are rendering your document from the command line? First thing to check is whether or not PHP throws any errors. You might want to enable error display, since you're running from the command line (though I always find having error logging enabled a benefit for debugging). Try this command instead:

php -d display_errors=1 dompdf.php -- -v t.html

You image is a PNG. Do you have GD enabled?

Regarding the first image. You said you have already enabled DOMPDF_ENABLE_REMOTE set to true. You enabled access to /tmp, but make sure this is the directory specified by DOMPDF_TEMP_DIR which is where dompdf needs read/write access when working with remote images. Finally, make sure you have allow_url_fopen set to true in your php.ini. Or enable it at run time:

php -d display_errors=1 -d allow_url_fopen=1 dompdf.php -- -v t.html

The second image will load relative to the current working directory (presumably your dompdf folder). The third image would be the absolute path to the image in the local file system. It looks like you've taken this in to account. Just make sure that all the above questions are addressed and that the image and temporary path is accessible to the account running dompdf.

@mdevendr
Copy link
Author

Thanks that was helpful. The idea was to test if the conversion was ok since I ran into issues with online rendering.

I downloaded the latest version again and after installation it was a success with command line. But failed over the online throwing the below errors.

Fatal error: Uncaught exception 'DOMPDF_Exception' with message 'Box property calculation requires containing block width' in /home/tindyt5/public_html/common/dompdf/include/block_frame_reflower.cls.php:171 
Stack trace: 
#0 /home/tindyt5/public_html/common/dompdf/include/block_frame_reflower.cls.php(673): Block_Frame_Reflower->_calculate_restricted_width() 
#1 /home/tindyt5/public_html/common/dompdf/include/frame_decorator.cls.php(556): Block_Frame_Reflower->reflow(Object(Block_Frame_Decorator)) 
#2 /home/tindyt5/public_html/common/dompdf/include/block_frame_reflower.cls.php(722): Frame_Decorator->reflow(Object(Block_Frame_Decorator)) 
#3 /home/tindyt5/public_html/common/dompdf/include/frame_decorator.cls.php(556): Block_Frame_Reflower->reflow(Object(Block_Frame_Decorator)) 
#4 /home/tindyt5/public_html/common/dompdf/include/block_frame_reflower.cls.php(722): Frame_Decorator->reflow(Object(Block_Frame_Decorator)) 
#5 /home/tindyt5/public_html/common/dompdf/include/frame_decorator.cls.php(556): Block_Frame_Reflower->reflow(NULL) in /home/tindyt5/public_html/common/dompdf/include/block_frame_reflower.cls.php on line 171

@bsweeney
Copy link
Member

Take a look at issue #250. A similar error was returned due to an invalid style.

@bsweeney bsweeney closed this as completed Nov 7, 2013
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