diff --git a/CHANGELOG.TXT b/CHANGELOG.TXT index 44bd601..16636ce 100644 --- a/CHANGELOG.TXT +++ b/CHANGELOG.TXT @@ -1,5 +1,6 @@ 6.0.016 (2013-05-15) - The tcpdf_addfont.php tool was improved (thanks to Remi Collet). + - Constant K_PATH_IMAGES is now automatically set in configuration file. 6.0.015 (2013-05-14) - Some unused vars were removed from AddFont() method. diff --git a/config/tcpdf_config.php b/config/tcpdf_config.php index 79d1edd..cb7bfd7 100644 --- a/config/tcpdf_config.php +++ b/config/tcpdf_config.php @@ -2,7 +2,7 @@ //============================================================+ // File name : tcpdf_config.php // Begin : 2004-06-11 -// Last Update : 2013-05-14 +// Last Update : 2013-05-15 // // Description : Configuration file for TCPDF. // Author : Nicola Asuni - Tecnick.com LTD - www.tecnick.com - info@tecnick.com @@ -114,10 +114,21 @@ if (!defined('K_TCPDF_EXTERNAL_CONFIG')) { */ define ('K_PATH_FONTS', K_PATH_MAIN.'fonts/'); + // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + // Try to automatically set the value for the following K_PATH_IMAGES constant. + // NOTE: delete this section and manually set the K_PATH_IMAGES constant below for better performances. + $tcpdf_images_dirs = array(K_PATH_MAIN.'examples/images/', '/usr/share/doc/tcpdf/', '/usr/share/doc/php-tcpdf/', '/usr/share/doc/php/tcpdf/', K_PATH_MAIN); + foreach ($tcpdf_images_dirs as $tcpdf_images_path) { + if (file_exists($tcpdf_images_path)) { + break; + } + } + // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + /** * Default images directory. */ - define ('K_PATH_IMAGES', K_PATH_MAIN.'examples/images/'); + define ('K_PATH_IMAGES', $tcpdf_images_path); /** * Blank image. diff --git a/examples/config/tcpdf_config_alt.php b/examples/config/tcpdf_config_alt.php index ce12aec..36ddb46 100644 --- a/examples/config/tcpdf_config_alt.php +++ b/examples/config/tcpdf_config_alt.php @@ -2,7 +2,7 @@ //============================================================+ // File name : tcpdf_config.php // Begin : 2004-06-11 -// Last Update : 2013-05-14 +// Last Update : 2013-05-15 // // Description : Example of alternative configuration file for TCPDF. // Author : Nicola Asuni - Tecnick.com LTD - www.tecnick.com - info@tecnick.com @@ -113,10 +113,21 @@ define ('K_PATH_CACHE', sys_get_temp_dir().'/'); */ define ('K_PATH_FONTS', K_PATH_MAIN.'fonts/'); +// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +// Try to automatically set the value for the following K_PATH_IMAGES constant. +// NOTE: delete this section and manually set the K_PATH_IMAGES constant below for better performances. +$tcpdf_images_dirs = array(K_PATH_MAIN.'examples/images/', '/usr/share/doc/tcpdf/', '/usr/share/doc/php-tcpdf/', '/usr/share/doc/php/tcpdf/', K_PATH_MAIN); +foreach ($tcpdf_images_dirs as $tcpdf_images_path) { + if (file_exists($tcpdf_images_path)) { + break; + } +} +// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + /** * Default images directory. */ -define ('K_PATH_IMAGES', K_PATH_MAIN.'examples/images/'); +define ('K_PATH_IMAGES', $tcpdf_images_path); /** * Blank image.