diff --git a/CHANGELOG.TXT b/CHANGELOG.TXT index 540a4fc..f53f4a4 100755 --- a/CHANGELOG.TXT +++ b/CHANGELOG.TXT @@ -1,3 +1,7 @@ +5.9.080 (2011-05-17) + - A problem related to file path calculation for images was fixed. + - A problem related to unsupressed getimagesize() error was fixed. + 5.9.079 (2011-05-16) - Footer() method was changed to use C128 barcode as default (instead of the previous C128B). diff --git a/README.TXT b/README.TXT index 556d870..f0d7fc5 100755 --- a/README.TXT +++ b/README.TXT @@ -8,8 +8,8 @@ http://sourceforge.net/donate/index.php?group_id=128076 ------------------------------------------------------------ Name: TCPDF -Version: 5.9.079 -Release date: 2011-05-16 +Version: 5.9.080 +Release date: 2011-05-17 Author: Nicola Asuni Copyright (c) 2002-2011: diff --git a/tcpdf.php b/tcpdf.php index 213298f..6aabfcc 100755 --- a/tcpdf.php +++ b/tcpdf.php @@ -1,9 +1,9 @@ * @package com.tecnick.tcpdf * @author Nicola Asuni - * @version 5.9.079 + * @version 5.9.080 */ // Main configuration file. Define the K_TCPDF_EXTERNAL_CONFIG constant to skip this file. @@ -146,7 +146,7 @@ require_once(dirname(__FILE__).'/config/tcpdf_config.php'); * TCPDF project (http://www.tcpdf.org) has been originally derived in 2002 from the Public Domain FPDF class by Olivier Plathey (http://www.fpdf.org), but now is almost entirely rewritten.
* @package com.tecnick.tcpdf * @brief PHP class for generating PDF documents without requiring external extensions. - * @version 5.9.079 + * @version 5.9.080 * @author Nicola Asuni - info@tecnick.com */ class TCPDF { @@ -157,7 +157,7 @@ class TCPDF { * Current TCPDF version. * @private */ - private $tcpdf_version = '5.9.079'; + private $tcpdf_version = '5.9.080'; // Protected properties @@ -7261,8 +7261,12 @@ class TCPDF { // encode spaces on filename (file is probably an URL) $file = str_replace(' ', '%20', $file); } - // get image dimensions - $imsize = @getimagesize($file); + if (@file_exists($file)) { + // get image dimensions + $imsize = @getimagesize($file); + } else { + $imsize = false; + } if ($imsize === FALSE) { if (function_exists('curl_init')) { // try to get remote file data using cURL @@ -20967,7 +20971,11 @@ Putting 1 is equivalent to putting 0 and calling Ln() just after. Default value: if (($tag['attribute']['src'][0] == '/') AND !empty($_SERVER['DOCUMENT_ROOT']) AND ($_SERVER['DOCUMENT_ROOT'] != '/')) { $findroot = strpos($tag['attribute']['src'], $_SERVER['DOCUMENT_ROOT']); if (($findroot === false) OR ($findroot > 1)) { - $tag['attribute']['src'] = $_SERVER['DOCUMENT_ROOT'].$tag['attribute']['src']; + if (substr($_SERVER['DOCUMENT_ROOT'], -1) == '/') { + $tag['attribute']['src'] = substr($_SERVER['DOCUMENT_ROOT'], 0, -1).$tag['attribute']['src']; + } else { + $tag['attribute']['src'] = $_SERVER['DOCUMENT_ROOT'].$tag['attribute']['src']; + } } } $tag['attribute']['src'] = urldecode($tag['attribute']['src']); @@ -26371,11 +26379,14 @@ Putting 1 is equivalent to putting 0 and calling Ln() just after. Default value: // replace relative path with full server path $img = $this->svgdir.'/'.$img; } - if (($img{0} == '/') AND ($_SERVER['DOCUMENT_ROOT'] != '/')) { + if (($img[0] == '/') AND !empty($_SERVER['DOCUMENT_ROOT']) AND ($_SERVER['DOCUMENT_ROOT'] != '/')) { $findroot = strpos($img, $_SERVER['DOCUMENT_ROOT']); if (($findroot === false) OR ($findroot > 1)) { - // replace relative path with full server path - $img = $_SERVER['DOCUMENT_ROOT'].$img; + if (substr($_SERVER['DOCUMENT_ROOT'], -1) == '/') { + $img = substr($_SERVER['DOCUMENT_ROOT'], 0, -1).$img; + } else { + $img = $_SERVER['DOCUMENT_ROOT'].$img; + } } } $img = urldecode($img);