Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

TCPDF ERROR: [Image] Unable to get image

Tags:

I'm using TCPDF with Drupal's print module to generate PDF of articles, & ending up with following error message when I click the link to generate PDF:

TCPDF ERROR: [Image] Unable to get image: http://localhost/pathToDrupal/themes/bartik/logo.png

The Image exists in the location specified. I tried applying:

allow_url_fopen = On; allow_url_include = On; 

in php.ini but that could not resolve the problem.

Please care to help :(

like image 712
Shafiul Avatar asked Oct 05 '11 17:10

Shafiul


People also ask

What is Tcpdf error?

Any error stating 'TCPDF' means that there was a problem with the generation of the PDF file.

How can I add image in Tcpdf?

$tcpdf = new TCPDF_TCPDF(); $img = file_get_contents(Mage::getBaseDir('media') . '/dhl/logo. jpg'); $PDF_HEADER_LOGO = $tcpdf->Image('@' . $img);//any image file.


1 Answers

Apparently the "fopen"-wrappers are not used by TCPDF.

If you supply the URL of an image, TCPDF tries to download it with cURL into the "cache"-directory where your TCPDF-installation is stored (you have to check what the K_PATH_CACHE-constant contains to be sure).

So I guess you have to have write permissions in this directory that the magic works. Also you need cURL enabled.

like image 75
vstm Avatar answered Apr 08 '23 15:04

vstm