From e06a71678b08dad77b76e2f67185c4d7c7b7e785 Mon Sep 17 00:00:00 2001 From: nicolaasuni Date: Mon, 21 Oct 2013 20:11:25 +0100 Subject: [PATCH] 6.0.041 (2013-10-21) - Bug #851 "Problem with images in PDF. PHP timing out" was fixed. --- CHANGELOG.TXT | 4 +++- README.TXT | 4 ++-- composer.json | 2 +- include/tcpdf_static.php | 2 +- tcpdf.php | 19 ++++++++++--------- 5 files changed, 17 insertions(+), 14 deletions(-) diff --git a/CHANGELOG.TXT b/CHANGELOG.TXT index 30a7aba..f123df7 100644 --- a/CHANGELOG.TXT +++ b/CHANGELOG.TXT @@ -1,6 +1,8 @@ +6.0.041 (2013-10-21) + - Bug #851 "Problem with images in PDF. PHP timing out" was fixed. + 6.0.040 (2013-10-20) - Bug #849 "SVG import bug" was fixed. - - Bug #851 "Problem with images in PDF. PHP timing out" was fixed. 6.0.039 (2013-10-13) - Bug #843 "Wrong call in parser" was fixed. diff --git a/README.TXT b/README.TXT index 80eb2ec..ff13378 100644 --- a/README.TXT +++ b/README.TXT @@ -8,8 +8,8 @@ http://sourceforge.net/donate/index.php?group_id=128076 ------------------------------------------------------------ Name: TCPDF -Version: 6.0.040 -Release date: 2013-10-20 +Version: 6.0.041 +Release date: 2013-10-21 Author: Nicola Asuni Copyright (c) 2002-2013: diff --git a/composer.json b/composer.json index 1db275a..385092d 100644 --- a/composer.json +++ b/composer.json @@ -1,6 +1,6 @@ { "name": "tecnick.com/tcpdf", - "version": "6.0.040", + "version": "6.0.041", "homepage": "http://www.tcpdf.org/", "type": "library", "description": "TCPDF is a PHP class for generating PDF documents.", diff --git a/include/tcpdf_static.php b/include/tcpdf_static.php index 77dd75e..a9d0fe3 100644 --- a/include/tcpdf_static.php +++ b/include/tcpdf_static.php @@ -55,7 +55,7 @@ class TCPDF_STATIC { * Current TCPDF version. * @private static */ - private static $tcpdf_version = '6.0.040'; + private static $tcpdf_version = '6.0.041'; /** * String alias for total number of pages. diff --git a/tcpdf.php b/tcpdf.php index 8ec5c3a..84e0e3a 100644 --- a/tcpdf.php +++ b/tcpdf.php @@ -1,9 +1,9 @@ * @package com.tecnick.tcpdf * @author Nicola Asuni - * @version 6.0.040 + * @version 6.0.041 */ // TCPDF configuration @@ -128,7 +128,7 @@ require_once(dirname(__FILE__).'/include/tcpdf_static.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 6.0.040 + * @version 6.0.041 * @author Nicola Asuni - info@tecnick.com */ class TCPDF { @@ -6801,10 +6801,10 @@ class TCPDF { $imgdata = TCPDF_STATIC::fileGetContents($file); } } - if (isset($imgdata) AND ($imgdata !== FALSE)) { + if (isset($imgdata) AND ($imgdata !== FALSE) AND (strpos($file, '__tcpdf_img') === FALSE)) { // copy image to cache $original_file = $file; - $file = TCPDF_STATIC::getObjFilename('img'); + $file = TCPDF_STATIC::getObjFilename('img'); //DEBUG $fp = fopen($file, 'w'); fwrite($fp, $imgdata); fclose($fp); @@ -6925,12 +6925,12 @@ class TCPDF { $newimage = true; } } - } elseif (($ismask === false) AND ($imgmask === false)) { - // check for cached images with alpha channel + } elseif (($ismask === false) AND ($imgmask === false) AND (strpos($file, '__tcpdf_imgmask_') === FALSE)) { // create temp image file (without alpha channel) $tempfile_plain = K_PATH_CACHE.'__tcpdf_imgmask_plain_'.$filehash; // create temp alpha file $tempfile_alpha = K_PATH_CACHE.'__tcpdf_imgmask_alpha_'.$filehash; + // check for cached images if (in_array($tempfile_plain, $this->imagekeys)) { // get existing image data $info = $this->getImageBuffer($tempfile_plain); @@ -6965,7 +6965,8 @@ class TCPDF { if ((method_exists('TCPDF_IMAGES', $mtd)) AND (!($resize AND (function_exists($gdfunction) OR extension_loaded('imagick'))))) { // TCPDF image functions $info = TCPDF_IMAGES::$mtd($file); - if (($info === 'pngalpha') OR (isset($info['trns']) AND !empty($info['trns']))) { + if (($ismask === false) AND ($imgmask === false) AND (strpos($file, '__tcpdf_imgmask_') === FALSE) + AND (($info === 'pngalpha') OR (isset($info['trns']) AND !empty($info['trns'])))) { return $this->ImagePngAlpha($file, $x, $y, $pixw, $pixh, $w, $h, 'PNG', $link, $align, $resize, $dpi, $palign, $filehash); } }