Nice pun, that one ;)
> perhaps you should take out the leading slash..? no need for
> /blah/img.jpg
>
> just put blah/img.jpg
That's not necessarily true. The web page could be in a subdirectory
of the site. So the path used really depends on his site structure.
On Jul 9, 1:25 pm, Esteban Cairol <
ecai...@gmail.com> wrote:
> Im having some problems when including image tags that use relative
> URLs. Seems that dompdf doesn't find the image. For example, if I use
> <img src="/img/logo.jpg" />, I get a red X and the image is not
> displayed.
>
> If I want them to appear, I have to put an absolute URL, like this:
> <img src="
http://www.mydomain.com/img/logo.jpg" />
>
> Im using the Cake framework, PHP5.
The main thing to focus on is how you're using DOMPDF. When you load
an HTML document via the local file system (e.g. $dompdf-
>load_html_file('myfile.html')) DOMPDF will have no knowledge of that
file being part of a web server. In this instance DOMPDF will assume
all path references in the document are local file system references.
This means DOMPDF will look for /img/logo.jpg in that location on the
file system. What you really want is for DOMPDF to look in /local/
filesystem/path/to/web/files/img/logo.jpg.
You only have one option if you don't want to rewrite all your image
source attributes to use a full URI. Specifically, load your HTML
document via your web server: $dompdf->load_html_file('http://
www.mysite.com/myfile.html');
Hope that helps.
-b