Images and ImagesRoot for HTML output

Topics: User Forum
Jul 21, 2011 at 4:16 PM

I am using PHPExcel to create a "printable" page of a schedule. I want an image in the header and when setting the path for a drawing, I know that you must use the absolute path to the file or you get an exception.



// gives File Not found exception, even though the logo.png file is actually in the root

So, when I export to HTML, I set the ImagesRoot:

// $server variable has uri to document root

But the link comes out like this:

Any ideas?
Jul 21, 2011 at 4:33 PM

I've also found that setting the path to an absolute path causes problem in PDF output as well.

Setting it to '/srv/www/htdocs/logo.png' causes TCPDF to look for it on a relative path and I get this error:

<strong>TCPDF ERROR: </strong>[Image] Unable to get image: ./srv/www/htdocs/logo.png

Note the dot. This means that any image you want to include must be in a directory below the directory where your script is, is that what I'm reading here?

Jan 27, 2013 at 8:11 PM
Edited Jan 27, 2013 at 8:12 PM

Any update to this? It loads the image correctly in Excel but there is problems with PDF & HTML output. I am included the image like





PDF Files give error
TCPDF ERROR: [Image] Unable to get image: ./home/www/


HTML Output

<img style="left: 0px; top: 0px; width: 110px; height: 50px;" src="./home/www/" border="0" alt="" width="110" height="50" />