lrost Le 28/07/2009 à 16:49 Bonjour,
Version 3.22
Voici mon html :
<img class="ex_icone img_toolbar_ex_defaut" height="40" alt="" width="40" src="/telem_fckeditor/css/img/ex/Categories.gif" />
et l'erreur que cela genere:
ERREUR n°6
Fichier : C:\wamp\www\html2pdf\html2pdf.class.php
Ligne : 1693
Impossible de charger l'image /telem_fckeditor/css/img/ex/Categories.gif
Merci pour vos réponses
Mon lien est bon, je vois correctement l'image sur ma page html
lrost Le 28/07/2009 à 17:02 J'ai trouvé.
le chemin doit s'écrire comme ca :img class="ex_icone img_toolbar_ex_defaut" height="40" alt="" width="40" src="./telem_fckeditor/css/img/ex/Categories.gif" />
Rajouter le .
al123 Le 30/07/2009 à 13:02 Hi
Firstly, thank you for your very useful scripts.
I'm also getting this Error
My server is set with allow_url_fopen = Off
If I change it to allow_url_fopen = On and restart the server there is no error and it works well, however I don't want allow_url_fopen to be On
I have tried replacing fopen in the functions _parsejpg and _parsepng with a curl alternative but this doesn't work.
a quick grep shows fopen in makefont.php
do I need to change this too, or are there any other functions that allow_url_fopen = Off stops images being read from external urls?
Merci
Andrew
Spipu Le 30/07/2009 à 15:32 allow_url_fopen is only needed in HTML2PDF for using external images, or using images created by PHP (like in example 9). If you don't want to set allow_url_fopen to On, you have just to copy the images in your local environment.
al123 Le 31/07/2009 à 08:45 Hi Spipu
I'm using html2pdf as part of a cms that I've written. The users of that cms can add blocks of text and links to external images.
I have done some more testing, and found that the error is caused by a test to see if getimagesize has returned an array
As I said I wanted to leave allow_url_fopen to Off, so to allow that to happen I've added the following code (in places where either fopen or getimagesize was used, eventually I'll turn it into a function after a bit more testing), to allow the image to be retrieved (which getimagesize attempts to do but was returning false with allow_url_open set to off)
Regards
Andrew
//example below
$ch = curl_init();
curl_setopt ($ch, CURLOPT_URL, $background['img']);
curl_setopt ($ch, CURLOPT_HEADER, 0);
//if behind proxy
//curl_setopt ($ch, CURLOPT_HTTPPROXYTUNNEL, 0);
//curl_setopt ($ch, CURLOPT_PROXY,'www.proxyurl.com:8080');
curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt ($ch, CURLOPT_CONNECTTIMEOUT, 30);
$file_contents = curl_exec($ch);
curl_close($ch);
$seed = $background['img'].timestamp();
$name = "/tmp/".md5($seed);
$fp = fopen($name, "w+");
fwrite($fp, $file_contents);
fclose($fp);
// est-ce que c'est une image ?
$infos=@GetImageSize($name);
@unlink($name);