I get my images in my pdf document on my localhost but on the production site i get the error TCPDF ERROR: [Image] Unable to get image
i am using an html img tag to get the images and the src is the directory path to this image not a url, but i found out that TCPDF is adding the path i give it with the path to my www folder like:
path to picture i give to tcpdf: home/inc_dir/img/pic.jpg
tcpdf looks for it here: home/www/home/inc_dir/pic.jpg
can someone please help me find out tcpdf is concatenating the directories?
TCPDF is using $_SERVER['DOCUMENT_ROOT']
as a root directory of all your images, and builds their absolute paths in relation to it. You can change it either in $_SERVER
or with this PHP constant: K_PATH_MAIN
:
define('K_PATH_MAIN', '/path/to/my-images/');
require_once 'tcpdf.php';