From 354739c739c699625c9b908c19b08e69a7494885 Mon Sep 17 00:00:00 2001 From: Nick Date: Wed, 12 Oct 2011 14:17:06 +0200 Subject: [PATCH] 5.9.130 --- CHANGELOG.TXT | 3 +++ README.TXT | 4 ++-- tcpdf.php | 54 ++++++++++++++++++++++++++++----------------------- 3 files changed, 35 insertions(+), 26 deletions(-) diff --git a/CHANGELOG.TXT b/CHANGELOG.TXT index f023a66..bb3f642 100755 --- a/CHANGELOG.TXT +++ b/CHANGELOG.TXT @@ -1,3 +1,6 @@ +5.9.130 (2011-10-12) + - Now you can set image data strings on HTML img tag by encoding the image binary data in this way: $imgsrc = '@'.base64_encode($imgdata); + 5.9.129 (2011-10-07) - Core fonts metrics was fixed (replace all helvetica and times php files on fonts folder). - Form fields support was improved and some problems were fixed (check the example n. 14). diff --git a/README.TXT b/README.TXT index e735aca..542d0b9 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.129 -Release date: 2011-10-07 +Version: 5.9.130 +Release date: 2011-10-12 Author: Nicola Asuni Copyright (c) 2002-2011: diff --git a/tcpdf.php b/tcpdf.php index 4eb4e43..8b93e77 100755 --- a/tcpdf.php +++ b/tcpdf.php @@ -1,9 +1,9 @@ * @package com.tecnick.tcpdf * @author Nicola Asuni - * @version 5.9.129 + * @version 5.9.130 */ // Main configuration file. Define the K_TCPDF_EXTERNAL_CONFIG constant to skip this file. @@ -149,7 +149,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.129 + * @version 5.9.130 * @author Nicola Asuni - info@tecnick.com */ class TCPDF { @@ -160,7 +160,7 @@ class TCPDF { * Current TCPDF version. * @private */ - private $tcpdf_version = '5.9.129'; + private $tcpdf_version = '5.9.130'; // Protected properties @@ -23055,27 +23055,33 @@ Putting 1 is equivalent to putting 0 and calling Ln() just after. Default value: } case 'img': { if (isset($tag['attribute']['src'])) { - // check for images without protocol - if (preg_match('%^/{2}%', $tag['attribute']['src'])) { - $tag['attribute']['src'] = 'http:'.$tag['attribute']['src']; - } - // replace relative path with real server path - 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)) { - 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']; + if ($tag['attribute']['src']{0} === '@') { + // data stream + $tag['attribute']['src'] = '@'.base64_decode(substr($tag['attribute']['src'], 1)); + $type = ''; + } else { + // check for images without protocol + if (preg_match('%^/{2}%', $tag['attribute']['src'])) { + $tag['attribute']['src'] = 'http:'.$tag['attribute']['src']; + } + // replace relative path with real server path + 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)) { + 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'] = htmlspecialchars_decode(urldecode($tag['attribute']['src'])); - $type = $this->getImageFileType($tag['attribute']['src']); - $testscrtype = @parse_url($tag['attribute']['src']); - if (!isset($testscrtype['query']) OR empty($testscrtype['query'])) { - // convert URL to server path - $tag['attribute']['src'] = str_replace(K_PATH_URL, K_PATH_MAIN, $tag['attribute']['src']); + $tag['attribute']['src'] = htmlspecialchars_decode(urldecode($tag['attribute']['src'])); + $type = $this->getImageFileType($tag['attribute']['src']); + $testscrtype = @parse_url($tag['attribute']['src']); + if (!isset($testscrtype['query']) OR empty($testscrtype['query'])) { + // convert URL to server path + $tag['attribute']['src'] = str_replace(K_PATH_URL, K_PATH_MAIN, $tag['attribute']['src']); + } } if (!isset($tag['width'])) { $tag['width'] = 0;