32
1
mirror of https://github.com/vdm-io/tcpdf.git synced 2024-11-22 12:55:10 +00:00

6.0.032 (2013-09-23)

- Bug #838 "Fatal error when imagick cannot handle the image, even though GD is available and can" was fixed.
This commit is contained in:
nicolaasuni 2013-09-23 10:22:53 +01:00
parent 0c26f23abf
commit 940dc4b24a
5 changed files with 92 additions and 96 deletions

View File

@ -1,3 +1,6 @@
6.0.032 (2013-09-23)
- Bug #838 "Fatal error when imagick cannot handle the image, even though GD is available and can" was fixed.
6.0.031 (2013-09-18)
- Bug #836 "Optional EOL marker before endstream" was fixed.
- Some additional controls were added to avoid "division by zero" error with badly formatted input.

View File

@ -8,8 +8,8 @@ http://sourceforge.net/donate/index.php?group_id=128076
------------------------------------------------------------
Name: TCPDF
Version: 6.0.031
Release date: 2013-09-18
Version: 6.0.032
Release date: 2013-09-23
Author: Nicola Asuni
Copyright (c) 2002-2013:
@ -107,4 +107,5 @@ Third party fonts:
The binary files (.z) that begins with the prefix "ae" have been extracted from the Arabeyes.org collection (GNU-GPLv2).
Link : http://projects.arabeyes.org/
============================================================

View File

@ -1,6 +1,6 @@
{
"name": "tecnick.com/tcpdf",
"version": "6.0.031",
"version": "6.0.032",
"homepage": "http://www.tcpdf.org/",
"type": "library",
"description": "TCPDF is a PHP class for generating PDF documents.",

View File

@ -55,7 +55,7 @@ class TCPDF_STATIC {
* Current TCPDF version.
* @private static
*/
private static $tcpdf_version = '6.0.031';
private static $tcpdf_version = '6.0.032';
/**
* String alias for total number of pages.

View File

@ -1,9 +1,9 @@
<?php
//============================================================+
// File name : tcpdf.php
// Version : 6.0.031
// Version : 6.0.032
// Begin : 2002-08-03
// Last Update : 2013-09-15
// Last Update : 2013-09-23
// Author : Nicola Asuni - Tecnick.com LTD - www.tecnick.com - info@tecnick.com
// License : GNU-LGPL v3 (http://www.gnu.org/copyleft/lesser.html)
// -------------------------------------------------------------------
@ -64,42 +64,7 @@
// * page compression (requires php-zlib extension);
// * XOBject Templates;
// * Layers and object visibility.
// * PDF/A-1b support.
//
// -----------------------------------------------------------
// THANKS TO:
//
// Olivier Plathey (http://www.fpdf.org) for original FPDF.
// Efthimios Mavrogeorgiadis (emavro@yahoo.com) for suggestions on RTL language support.
// Klemen Vodopivec (http://www.fpdf.de/downloads/addons/37/) for Encryption algorithm.
// Warren Sherliker (wsherliker@gmail.com) for better image handling.
// dullus for text Justification.
// Bob Vincent (pillarsdotnet@users.sourceforge.net) for <li> value attribute.
// Patrick Benny for text stretch suggestion on Cell().
// Johannes Güntert for JavaScript support.
// Denis Van Nuffelen for Dynamic Form.
// Jacek Czekaj for multibyte justification
// Anthony Ferrara for the reintroduction of legacy image methods.
// Sourceforge user 1707880 (hucste) for line-through mode.
// Larry Stanbery for page groups.
// Martin Hall-May for transparency.
// Aaron C. Spike for Polycurve method.
// Mohamad Ali Golkar, Saleh AlMatrafe, Charles Abbott for Arabic and Persian support.
// Moritz Wagner and Andreas Wurmser for graphic functions.
// Andrew Whitehead for core fonts support.
// Esteban Joël Marín for OpenType font conversion.
// Teus Hagen for several suggestions and fixes.
// Yukihiro Nakadaira for CID-0 CJK fonts fixes.
// Kosmas Papachristos for some CSS improvements.
// Marcel Partap for some fixes.
// Won Kyu Park for several suggestions, fixes and patches.
// Dominik Dzienia for QR-code support.
// Laurent Minguet for some suggestions.
// Christian Deligant for some suggestions and fixes.
// Travis Harris for crop mark suggestion.
// Aleksey Kuznetsov for some suggestions and text shadows.
// Jim Hanlon for several suggestions and patches.
// Anyone else that has reported a bug or sent a suggestion.
// * PDF/A-1b support
//============================================================+
/**
@ -139,7 +104,7 @@
* Tools to encode your unicode fonts are on fonts/utils directory.</p>
* @package com.tecnick.tcpdf
* @author Nicola Asuni
* @version 6.0.031
* @version 6.0.032
*/
// TCPDF configuration
@ -163,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.<br>
* @package com.tecnick.tcpdf
* @brief PHP class for generating PDF documents without requiring external extensions.
* @version 6.0.031
* @version 6.0.032
* @author Nicola Asuni - info@tecnick.com
*/
class TCPDF {
@ -6990,8 +6955,8 @@ class TCPDF {
return $this->ImagePngAlpha($file, $x, $y, $pixw, $pixh, $w, $h, 'PNG', $link, $align, $resize, $dpi, $palign, $filehash);
}
}
if (!$info) {
if (function_exists($gdfunction)) {
if (($info === false) AND function_exists($gdfunction)) {
try {
// GD library
$img = $gdfunction($file);
if ($resize) {
@ -7012,7 +6977,12 @@ class TCPDF {
$info = TCPDF_IMAGES::_toJPEG($img, $this->jpeg_quality);
}
}
} elseif (extension_loaded('imagick')) {
} catch(Exception $e) {
$info = false;
}
}
if (($info === false) AND extension_loaded('imagick')) {
try {
// ImageMagick library
$img = new Imagick();
if ($type == 'SVG') {
@ -7063,12 +7033,12 @@ class TCPDF {
$info = TCPDF_IMAGES::_parsejpeg($tempname);
unlink($tempname);
$img->destroy();
} else {
return;
} catch(Exception $e) {
$info = false;
}
}
if ($info === false) {
//If false, we cannot process image
// unable to process image
return;
}
TCPDF_STATIC::set_mqr($mqr);
@ -7199,7 +7169,11 @@ class TCPDF {
$tempfile_plain = K_PATH_CACHE.'mskp_'.$filehash;
// create temp alpha file
$tempfile_alpha = K_PATH_CACHE.'mska_'.$filehash;
if (extension_loaded('imagick')) { // ImageMagick extension
$parsed = false;
$parse_error = '';
// ImageMagick extension
if (($parsed === false) AND extension_loaded('imagick')) {
try {
// ImageMagick library
$img = new Imagick();
$img->readImage($file);
@ -7222,7 +7196,15 @@ class TCPDF {
}
$imga->setImageFormat('png');
$imga->writeImage($tempfile_plain);
} elseif (function_exists('imagecreatefrompng')) { // GD extension
$parsed = true;
} catch (Exception $e) {
// Imagemagick fails, try with GD
$parse_error = 'Imagick library error: '.$e->getMessage();
}
}
// GD extension
if (($parsed === false) AND function_exists('imagecreatefrompng')) {
try {
// generate images
$img = imagecreatefrompng($file);
$imgalpha = imagecreate($wpx, $hpx);
@ -7245,8 +7227,18 @@ class TCPDF {
imagecopy($imgplain, $img, 0, 0, 0, 0, $wpx, $hpx);
imagepng($imgplain, $tempfile_plain);
imagedestroy($imgplain);
} else {
$parsed = true;
} catch (Exception $e) {
// GD fails
$parse_error = 'GD library error: '.$e->getMessage();
}
}
if ($parsed === false) {
if (empty($parse_error)) {
$this->Error('TCPDF requires the Imagick or GD extension to handle PNG images with alpha channel.');
} else {
$this->Error($parse_error);
}
}
// embed mask image
$imgmask = $this->Image($tempfile_alpha, $x, $y, $w, $h, 'PNG', '', '', $resize, $dpi, '', true, false);