domPDF Images

#1
[eluser]flaky[/eluser]
I'm having this strange problem. When generating the pdf locally the images are displayed in the pdf file, but when I upload it to the public server I only get the html printed on the pdf and not the image. Yes I've checked the image path and everything.

I have searched the forum for similar problems, and there seem to have been some, but those solutions aren't working for me.

Any suggestions?

the view (head only including the image)
Code:
<html>
    <head>
        <style type="text/css">
            body{
                font-size: 10px;
            }
            
            table{
                border: 1px solid;
                border-color: #aaa;
            }
            
            table th{
                border: 1px solid;
                border-color: #aaa;
            }
            
            table td{
                border: 1px solid;
                border-color: #aaa;
            }
            
            #img{
                margin-left: 25px;
                margin-top: 10px;
                margin-bottom: 20px;
                height: 50px;
            }
        </style>
    </head>
    
    <body>
        <img src="&lt;?php echo base_url() . 'assets/img/ba-logo-web.jpg'; ?&gt;" id="img" />

the function
Code:
$this->load->plugin('to_pdf');
                
                $this->template->write_view('content', 'details_pdf', $data);    
                $html = $this->template->render('content');
                
                pdf_create($html, 'filename');

#2
[eluser]htdev[/eluser]
did you ever figure this out?

the problem I'm having with images is that in the PDF, the image is just a red X. When I write the html out to the page, the image shows fine though, just not in the pdf.

#3
[eluser]flaky[/eluser]
I found out that it was servers fault

#4
[eluser]emorling[/eluser]
The SOLUTION for including images in domPDF.

It doesn't matter that the images display in your browser.

You must include the server path to the image.

In my case it was this (img resides in the same folder as my system folder):

<img src="./img/pdf/logo.png">

#5
[eluser]htdev[/eluser]
[quote author="emorling" date="1284432529"]You must include the server path to the image.[/quote]
well, my system folder is outside the web root. so I would need the full server path to the image then and not the full URL?


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2021 MyBB Group.