32
1
mirror of https://github.com/vdm-io/tcpdf.git synced 2024-12-23 00:48:55 +00:00
This commit is contained in:
nicolaasuni 2010-04-20 16:21:30 +02:00
parent eff7f0e36e
commit d6689660fe
21 changed files with 572 additions and 389 deletions

View File

@ -1,3 +1,9 @@
4.9.016 (2010-04-20)
- An error on htmlcolors.php was fixed.
- getImageFileType() method was improved.
- GIF images with transparency are now better supported.
- Automatic page orientation was improved.
4.9.015 (2010-04-20)
- A new method copyPage() was added to clone pages (see example n. 44).
- Support for text overline was added.

View File

@ -8,7 +8,7 @@ http://sourceforge.net/donate/index.php?group_id=128076
------------------------------------------------------------
Name: TCPDF
Version: 4.9.015
Version: 4.9.016
Release date: 2010-04-20
Author: Nicola Asuni

View File

@ -55,7 +55,7 @@
<div class="credit">
<hr />
Documentation generated on Tue, 20 Apr 2010 12:13:32 +0200 by <a href="http://www.phpdoc.org">phpDocumentor 1.4.3</a>
Documentation generated on Tue, 20 Apr 2010 16:21:17 +0200 by <a href="http://www.phpdoc.org">phpDocumentor 1.4.3</a>
</div>
</td></tr></table>
</td>

View File

@ -5548,7 +5548,7 @@ $frame)</code>
<div class="credit">
<hr />
Documentation generated on Tue, 20 Apr 2010 12:13:32 +0200 by <a href="http://www.phpdoc.org">phpDocumentor 1.4.3</a>
Documentation generated on Tue, 20 Apr 2010 16:21:17 +0200 by <a href="http://www.phpdoc.org">phpDocumentor 1.4.3</a>
</div>
</td></tr></table>
</td>

File diff suppressed because it is too large Load Diff

View File

@ -296,7 +296,7 @@ $type)</code>
<div class="credit">
<hr />
Documentation generated on Tue, 20 Apr 2010 12:13:32 +0200 by <a href="http://www.phpdoc.org">phpDocumentor 1.4.3</a>
Documentation generated on Tue, 20 Apr 2010 16:21:17 +0200 by <a href="http://www.phpdoc.org">phpDocumentor 1.4.3</a>
</div>
</td></tr></table>
</td>

View File

@ -1374,7 +1374,7 @@ $type)</code>
<div class="credit">
<hr />
Documentation generated on Tue, 20 Apr 2010 12:13:32 +0200 by <a href="http://www.phpdoc.org">phpDocumentor 1.4.3</a>
Documentation generated on Tue, 20 Apr 2010 16:21:17 +0200 by <a href="http://www.phpdoc.org">phpDocumentor 1.4.3</a>
</div>
</td></tr></table>
</td>

View File

@ -102,7 +102,7 @@ PHP class to creates array representations for 2D barcodes to be used with TCPDF
<div class="credit">
<hr />
Documentation generated on Tue, 20 Apr 2010 12:13:32 +0200 by <a href="http://www.phpdoc.org">phpDocumentor 1.4.3</a>
Documentation generated on Tue, 20 Apr 2010 16:21:17 +0200 by <a href="http://www.phpdoc.org">phpDocumentor 1.4.3</a>
</div>
</td></tr></table>
</td>

View File

@ -102,7 +102,7 @@ PHP class to creates array representations for common 1D barcodes to be used wit
<div class="credit">
<hr />
Documentation generated on Tue, 20 Apr 2010 12:13:32 +0200 by <a href="http://www.phpdoc.org">phpDocumentor 1.4.3</a>
Documentation generated on Tue, 20 Apr 2010 16:21:17 +0200 by <a href="http://www.phpdoc.org">phpDocumentor 1.4.3</a>
</div>
</td></tr></table>
</td>

View File

@ -539,7 +539,7 @@ Configuration file for TCPDF.<br /><br /><br /><br />
<div class="credit">
<hr />
Documentation generated on Tue, 20 Apr 2010 12:13:35 +0200 by <a href="http://www.phpdoc.org">phpDocumentor 1.4.3</a>
Documentation generated on Tue, 20 Apr 2010 16:21:20 +0200 by <a href="http://www.phpdoc.org">phpDocumentor 1.4.3</a>
</div>
</td></tr></table>
</td>

View File

@ -94,7 +94,7 @@ Array of WEB safe colors.<br /><br /><br /><br />
<div class="credit">
<hr />
Documentation generated on Tue, 20 Apr 2010 12:13:32 +0200 by <a href="http://www.phpdoc.org">phpDocumentor 1.4.3</a>
Documentation generated on Tue, 20 Apr 2010 16:21:17 +0200 by <a href="http://www.phpdoc.org">phpDocumentor 1.4.3</a>
</div>
</td></tr></table>
</td>

View File

@ -477,7 +477,7 @@ string $string, [int $split_length = 1])</code>
<div class="credit">
<hr />
Documentation generated on Tue, 20 Apr 2010 12:13:32 +0200 by <a href="http://www.phpdoc.org">phpDocumentor 1.4.3</a>
Documentation generated on Tue, 20 Apr 2010 16:21:17 +0200 by <a href="http://www.phpdoc.org">phpDocumentor 1.4.3</a>
</div>
</td></tr></table>
</td>

View File

@ -79,7 +79,7 @@ This is a PHP class for generating PDF documents without requiring external exte
<td><b>author:</b>&nbsp;&nbsp;</td><td>Nicola Asuni</td>
</tr>
<tr>
<td><b>version:</b>&nbsp;&nbsp;</td><td>4.9.015</td>
<td><b>version:</b>&nbsp;&nbsp;</td><td>4.9.016</td>
</tr>
<tr>
<td><b>copyright:</b>&nbsp;&nbsp;</td><td>2002-2010 Nicola Asuni - Tecnick.com S.r.l (www.tecnick.com) Via Della Pace, 11 - 09044 - Quartucciu (CA) - ITALY - www.tecnick.com - info@tecnick.com</td>
@ -110,7 +110,7 @@ unicode data<br /><br /></div>
<div class="tags">
<table width="90%" border="0" cellspacing="0" cellpadding="1"><tr><td class="code_border">
<table width="100%" border="0" cellspacing="0" cellpadding="2"><tr><td class="code">
<code>PDF_PRODUCER = 'TCPDF 4.9.015 (http://www.tcpdf.org)'</code>
<code>PDF_PRODUCER = 'TCPDF 4.9.016 (http://www.tcpdf.org)'</code>
</td></tr></table>
</td></tr></table>
@ -121,7 +121,7 @@ unicode data<br /><br /></div>
<div class="credit">
<hr />
Documentation generated on Tue, 20 Apr 2010 12:13:33 +0200 by <a href="http://www.phpdoc.org">phpDocumentor 1.4.3</a>
Documentation generated on Tue, 20 Apr 2010 16:21:18 +0200 by <a href="http://www.phpdoc.org">phpDocumentor 1.4.3</a>
</div>
</td></tr></table>
</td>

View File

@ -243,7 +243,7 @@ Unicode Include file for TCPDF.<br /><br /><br /><br />
<div class="credit">
<hr />
Documentation generated on Tue, 20 Apr 2010 12:13:35 +0200 by <a href="http://www.phpdoc.org">phpDocumentor 1.4.3</a>
Documentation generated on Tue, 20 Apr 2010 16:21:21 +0200 by <a href="http://www.phpdoc.org">phpDocumentor 1.4.3</a>
</div>
</td></tr></table>
</td>

View File

@ -610,7 +610,7 @@
<dt><b>getImageBuffer</b></dt>
<dd>in file tcpdf.php, method <a href="com-tecnick-tcpdf/TCPDF.html#methodgetImageBuffer">TCPDF::getImageBuffer()</a><br>&nbsp;&nbsp;&nbsp;&nbsp;Get image buffer content.</dd>
<dt><b>getImageFileType</b></dt>
<dd>in file tcpdf.php, method <a href="com-tecnick-tcpdf/TCPDF.html#methodgetImageFileType">TCPDF::getImageFileType()</a><br>&nbsp;&nbsp;&nbsp;&nbsp;Return the image type given the file name and path</dd>
<dd>in file tcpdf.php, method <a href="com-tecnick-tcpdf/TCPDF.html#methodgetImageFileType">TCPDF::getImageFileType()</a><br>&nbsp;&nbsp;&nbsp;&nbsp;Return the image type given the file name or array returned by getimagesize() function.</dd>
<dt><b>getImageRBX</b></dt>
<dd>in file tcpdf.php, method <a href="com-tecnick-tcpdf/TCPDF.html#methodgetImageRBX">TCPDF::getImageRBX()</a><br>&nbsp;&nbsp;&nbsp;&nbsp;Return the right-bottom (or left-bottom for RTL) corner X coordinate of last inserted image</dd>
<dt><b>getImageRBY</b></dt>
@ -1845,12 +1845,16 @@
<dd>in file tcpdf.php, method <a href="com-tecnick-tcpdf/TCPDF.html#method_putxobjectdict">TCPDF::_putxobjectdict()</a><br>&nbsp;&nbsp;&nbsp;&nbsp;Output object dictionary for images.</dd>
<dt><b>_RC4</b></dt>
<dd>in file tcpdf.php, method <a href="com-tecnick-tcpdf/TCPDF.html#method_RC4">TCPDF::_RC4()</a><br>&nbsp;&nbsp;&nbsp;&nbsp;Returns the input text exrypted using RC4 algorithm and the specified key.</dd>
<dt><b>_setGDImageTransparency</b></dt>
<dd>in file tcpdf.php, method <a href="com-tecnick-tcpdf/TCPDF.html#method_setGDImageTransparency">TCPDF::_setGDImageTransparency()</a><br>&nbsp;&nbsp;&nbsp;&nbsp;Set the transparency for the given GD image.</dd>
<dt><b>_textannobjstring</b></dt>
<dd>in file tcpdf.php, method <a href="com-tecnick-tcpdf/TCPDF.html#method_textannobjstring">TCPDF::_textannobjstring()</a><br>&nbsp;&nbsp;&nbsp;&nbsp;Format a UTF-8 text string for meta information on annotations</dd>
<dt><b>_textstring</b></dt>
<dd>in file tcpdf.php, method <a href="com-tecnick-tcpdf/TCPDF.html#method_textstring">TCPDF::_textstring()</a><br>&nbsp;&nbsp;&nbsp;&nbsp;Format a text string for meta information</dd>
<dt><b>_toJPEG</b></dt>
<dd>in file tcpdf.php, method <a href="com-tecnick-tcpdf/TCPDF.html#method_toJPEG">TCPDF::_toJPEG()</a><br>&nbsp;&nbsp;&nbsp;&nbsp;Convert the loaded php image to a JPEG and then return a structure for the PDF creator.</dd>
<dd>in file tcpdf.php, method <a href="com-tecnick-tcpdf/TCPDF.html#method_toJPEG">TCPDF::_toJPEG()</a><br>&nbsp;&nbsp;&nbsp;&nbsp;Convert the loaded image to a JPEG and then return a structure for the PDF creator.</dd>
<dt><b>_toPNG</b></dt>
<dd>in file tcpdf.php, method <a href="com-tecnick-tcpdf/TCPDF.html#method_toPNG">TCPDF::_toPNG()</a><br>&nbsp;&nbsp;&nbsp;&nbsp;Convert the loaded image to a PNG and then return a structure for the PDF creator.</dd>
<dt><b>_Uvalue</b></dt>
<dd>in file tcpdf.php, method <a href="com-tecnick-tcpdf/TCPDF.html#method_Uvalue">TCPDF::_Uvalue()</a><br>&nbsp;&nbsp;&nbsp;&nbsp;Compute U value (used for RC4 encryption)</dd>
<dt><b>__construct</b></dt>
@ -1868,7 +1872,7 @@
<a href="elementindex.html#top">top</a><br>
<div class="credit">
<hr />
Documentation generated on Tue, 20 Apr 2010 12:13:32 +0200 by <a href="http://www.phpdoc.org">phpDocumentor 1.4.3</a>
Documentation generated on Tue, 20 Apr 2010 16:21:17 +0200 by <a href="http://www.phpdoc.org">phpDocumentor 1.4.3</a>
</div>
</td></tr></table>
</td>

View File

@ -216,12 +216,16 @@
<dd>in file tcpdf.php, method <a href="com-tecnick-tcpdf/TCPDF.html#method_putxobjectdict">TCPDF::_putxobjectdict()</a><br>&nbsp;&nbsp;&nbsp;&nbsp;Output object dictionary for images.</dd>
<dt><b>_RC4</b></dt>
<dd>in file tcpdf.php, method <a href="com-tecnick-tcpdf/TCPDF.html#method_RC4">TCPDF::_RC4()</a><br>&nbsp;&nbsp;&nbsp;&nbsp;Returns the input text exrypted using RC4 algorithm and the specified key.</dd>
<dt><b>_setGDImageTransparency</b></dt>
<dd>in file tcpdf.php, method <a href="com-tecnick-tcpdf/TCPDF.html#method_setGDImageTransparency">TCPDF::_setGDImageTransparency()</a><br>&nbsp;&nbsp;&nbsp;&nbsp;Set the transparency for the given GD image.</dd>
<dt><b>_textannobjstring</b></dt>
<dd>in file tcpdf.php, method <a href="com-tecnick-tcpdf/TCPDF.html#method_textannobjstring">TCPDF::_textannobjstring()</a><br>&nbsp;&nbsp;&nbsp;&nbsp;Format a UTF-8 text string for meta information on annotations</dd>
<dt><b>_textstring</b></dt>
<dd>in file tcpdf.php, method <a href="com-tecnick-tcpdf/TCPDF.html#method_textstring">TCPDF::_textstring()</a><br>&nbsp;&nbsp;&nbsp;&nbsp;Format a text string for meta information</dd>
<dt><b>_toJPEG</b></dt>
<dd>in file tcpdf.php, method <a href="com-tecnick-tcpdf/TCPDF.html#method_toJPEG">TCPDF::_toJPEG()</a><br>&nbsp;&nbsp;&nbsp;&nbsp;Convert the loaded php image to a JPEG and then return a structure for the PDF creator.</dd>
<dd>in file tcpdf.php, method <a href="com-tecnick-tcpdf/TCPDF.html#method_toJPEG">TCPDF::_toJPEG()</a><br>&nbsp;&nbsp;&nbsp;&nbsp;Convert the loaded image to a JPEG and then return a structure for the PDF creator.</dd>
<dt><b>_toPNG</b></dt>
<dd>in file tcpdf.php, method <a href="com-tecnick-tcpdf/TCPDF.html#method_toPNG">TCPDF::_toPNG()</a><br>&nbsp;&nbsp;&nbsp;&nbsp;Convert the loaded image to a PNG and then return a structure for the PDF creator.</dd>
<dt><b>_Uvalue</b></dt>
<dd>in file tcpdf.php, method <a href="com-tecnick-tcpdf/TCPDF.html#method_Uvalue">TCPDF::_Uvalue()</a><br>&nbsp;&nbsp;&nbsp;&nbsp;Compute U value (used for RC4 encryption)</dd>
<dt><b>__construct</b></dt>
@ -777,7 +781,7 @@
<dt><b>getImageBuffer</b></dt>
<dd>in file tcpdf.php, method <a href="com-tecnick-tcpdf/TCPDF.html#methodgetImageBuffer">TCPDF::getImageBuffer()</a><br>&nbsp;&nbsp;&nbsp;&nbsp;Get image buffer content.</dd>
<dt><b>getImageFileType</b></dt>
<dd>in file tcpdf.php, method <a href="com-tecnick-tcpdf/TCPDF.html#methodgetImageFileType">TCPDF::getImageFileType()</a><br>&nbsp;&nbsp;&nbsp;&nbsp;Return the image type given the file name and path</dd>
<dd>in file tcpdf.php, method <a href="com-tecnick-tcpdf/TCPDF.html#methodgetImageFileType">TCPDF::getImageFileType()</a><br>&nbsp;&nbsp;&nbsp;&nbsp;Return the image type given the file name or array returned by getimagesize() function.</dd>
<dt><b>getImageRBX</b></dt>
<dd>in file tcpdf.php, method <a href="com-tecnick-tcpdf/TCPDF.html#methodgetImageRBX">TCPDF::getImageRBX()</a><br>&nbsp;&nbsp;&nbsp;&nbsp;Return the right-bottom (or left-bottom for RTL) corner X coordinate of last inserted image</dd>
<dt><b>getImageRBY</b></dt>
@ -1897,7 +1901,7 @@
<a href="elementindex_com-tecnick-tcpdf.html#top">top</a><br>
<div class="credit">
<hr />
Documentation generated on Tue, 20 Apr 2010 12:13:31 +0200 by <a href="http://www.phpdoc.org">phpDocumentor 1.4.3</a>
Documentation generated on Tue, 20 Apr 2010 16:21:17 +0200 by <a href="http://www.phpdoc.org">phpDocumentor 1.4.3</a>
</div>
</td></tr></table>
</td>

View File

@ -35,7 +35,7 @@
<a href="#Post-parsing">Post-parsing</a><br>
<div class="credit">
<hr />
Documentation generated on Tue, 20 Apr 2010 12:13:35 +0200 by <a href="http://www.phpdoc.org">phpDocumentor 1.4.3</a>
Documentation generated on Tue, 20 Apr 2010 16:21:21 +0200 by <a href="http://www.phpdoc.org">phpDocumentor 1.4.3</a>
</div>
</td></tr></table>
</td>

View File

@ -64,7 +64,7 @@
This documentation was generated by <a href="http://www.phpdoc.org">phpDocumentor v1.4.3</a><br />
<div class="credit">
<hr />
Documentation generated on Tue, 20 Apr 2010 12:13:32 +0200 by <a href="http://www.phpdoc.org">phpDocumentor 1.4.3</a>
Documentation generated on Tue, 20 Apr 2010 16:21:17 +0200 by <a href="http://www.phpdoc.org">phpDocumentor 1.4.3</a>
</div>
</td></tr></table>
</td>

View File

@ -64,7 +64,7 @@
This documentation was generated by <a href="http://www.phpdoc.org">phpDocumentor v1.4.3</a><br />
<div class="credit">
<hr />
Documentation generated on Tue, 20 Apr 2010 12:13:32 +0200 by <a href="http://www.phpdoc.org">phpDocumentor 1.4.3</a>
Documentation generated on Tue, 20 Apr 2010 16:21:17 +0200 by <a href="http://www.phpdoc.org">phpDocumentor 1.4.3</a>
</div>
</td></tr></table>
</td>

View File

@ -2,8 +2,8 @@
//============================================================+
// File name : htmlcolors.php
// Begin : 2002-04-09
// Last Update : 2009-09-06
// Version : 1.0.003
// Last Update : 2010-04-20
// Version : 1.0.004
// License : GNU LGPL (http://www.gnu.org/copyleft/lesser.html)
// ----------------------------------------------------------------------------
// Copyright (C) 2002-2009 Nicola Asuni - Tecnick.com S.r.l.
@ -113,8 +113,8 @@ $webcolor = array (
'greenyellow' => 'adff2f',
'honeydew' => 'f0fff0',
'hotpink' => 'ff69b4',
'indianred ' => 'cd5c5c',
'indigo ' => '4b0082',
'indianred' => 'cd5c5c',
'indigo' => '4b0082',
'ivory' => 'fffff0',
'khaki' => 'f0e68c',
'lavender' => 'e6e6fa',

115
tcpdf.php
View File

@ -2,9 +2,9 @@
//============================================================+
// File name : tcpdf.php
// Begin : 2002-08-03
// Last Update : 2010-04-19
// Last Update : 2010-04-20
// Author : Nicola Asuni - info@tecnick.com - http://www.tcpdf.org
// Version : 4.9.015
// Version : 4.9.016
// License : GNU LGPL (http://www.gnu.org/copyleft/lesser.html)
// ----------------------------------------------------------------------------
// Copyright (C) 2002-2010 Nicola Asuni - Tecnick.com S.r.l.
@ -121,7 +121,7 @@
* @copyright 2002-2010 Nicola Asuni - Tecnick.com S.r.l (www.tecnick.com) Via Della Pace, 11 - 09044 - Quartucciu (CA) - ITALY - www.tecnick.com - info@tecnick.com
* @link http://www.tcpdf.org
* @license http://www.gnu.org/copyleft/lesser.html LGPL
* @version 4.9.015
* @version 4.9.016
*/
/**
@ -145,14 +145,14 @@ if (!class_exists('TCPDF', false)) {
/**
* define default PDF document producer
*/
define('PDF_PRODUCER', 'TCPDF 4.9.015 (http://www.tcpdf.org)');
define('PDF_PRODUCER', 'TCPDF 4.9.016 (http://www.tcpdf.org)');
/**
* This is a PHP class for generating PDF documents without requiring external extensions.<br>
* 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>
* @name TCPDF
* @package com.tecnick.tcpdf
* @version 4.9.015
* @version 4.9.016
* @author Nicola Asuni - info@tecnick.com
* @link http://www.tcpdf.org
* @license http://www.gnu.org/copyleft/lesser.html LGPL
@ -1824,17 +1824,28 @@ if (!class_exists('TCPDF', false)) {
* @since 3.0.015 (2008-06-06)
*/
public function setPageOrientation($orientation, $autopagebreak='', $bottommargin='') {
$orientation = strtoupper($orientation);
if (($orientation == 'P') OR ($orientation == 'PORTRAIT')) {
$this->CurOrientation = 'P';
$this->wPt = $this->fwPt;
$this->hPt = $this->fhPt;
} elseif (($orientation == 'L') OR ($orientation == 'LANDSCAPE')) {
$this->CurOrientation = 'L';
if ($this->fwPt > $this->fhPt) {
// landscape
$default_orientation = 'L';
} else {
// portrait
$default_orientation = 'P';
}
$valid_orientations = array('P', 'L');
if (empty($orientation)) {
$orientation = $default_orientation;
} else {
$orientation = $orientation{0};
$orientation = strtoupper($orientation);
}
if (in_array($orientation, $valid_orientations) AND ($orientation != $default_orientation)) {
$this->CurOrientation = $orientation;
$this->wPt = $this->fhPt;
$this->hPt = $this->fwPt;
} else {
$this->Error('Incorrect orientation: '.$orientation);
$this->CurOrientation = $default_orientation;
$this->wPt = $this->fwPt;
$this->hPt = $this->fhPt;
}
$this->w = $this->wPt / $this->k;
$this->h = $this->hPt / $this->k;
@ -5031,20 +5042,27 @@ if (!class_exists('TCPDF', false)) {
}
/**
* Return the image type given the file name and path
* Return the image type given the file name or array returned by getimagesize() function.
* @param string $imgfile image file name
* @param array $iminfo array of image information returned by getimagesize() function.
* @return string image type
* @since 4.8.017 (2009-11-27)
*/
public function getImageFileType($imgfile) {
$type = ''; // default type
public function getImageFileType($imgfile, $iminfo=array()) {
if (isset($iminfo['mime']) AND !empty($iminfo['mime'])) {
$mime = explode('/', $iminfo['mime']);
if ((count($mime) > 1) AND ($mime[0] == 'image') AND (!empty($mime[1]))) {
return trim($mime[1]);
}
}
$type = '';
$fileinfo = pathinfo($imgfile);
if (isset($fileinfo['extension']) AND (!$this->empty_string($fileinfo['extension']))) {
$type = strtolower($fileinfo['extension']);
$type = strtolower(trim($fileinfo['extension']));
}
if ($type == 'jpg') {
$type = 'jpeg';
}
}
return $type;
}
@ -5164,7 +5182,7 @@ if (!class_exists('TCPDF', false)) {
if ($newimage) {
//First use of image, get info
if ($type == '') {
$type = $this->getImageFileType($file);
$type = $this->getImageFileType($file, $imsize);
}
$mqr = $this->get_mqr();
$this->set_mqr(false);
@ -5186,10 +5204,21 @@ if (!class_exists('TCPDF', false)) {
$img = $gdfunction($file);
if ($resize) {
$imgr = imagecreatetruecolor($neww, $newh);
if (($type == 'gif') OR ($type == 'png')) {
$imgr = $this->_setGDImageTransparency($imgr, $img);
}
imagecopyresampled($imgr, $img, 0, 0, 0, 0, $neww, $newh, $pixw, $pixh);
$info = $this->_toJPEG($imgr);
if (($type == 'gif') OR ($type == 'png')) {
$info = $this->_toPNG($imgr);
} else {
$info = $this->_toJPEG($imgr);
}
} else {
$info = $this->_toJPEG($img);
if (($type == 'gif') OR ($type == 'png')) {
$info = $this->_toPNG($img);
} else {
$info = $this->_toJPEG($img);
}
}
} elseif (extension_loaded('imagick')) {
// ImageMagick library
@ -5339,7 +5368,7 @@ if (!class_exists('TCPDF', false)) {
}
/**
* Convert the loaded php image to a JPEG and then return a structure for the PDF creator.
* Convert the loaded image to a JPEG and then return a structure for the PDF creator.
* This function requires GD library and write access to the directory defined on K_PATH_CACHE constant.
* @param string $file Image file name.
* @param image $image Image object.
@ -5356,6 +5385,48 @@ if (!class_exists('TCPDF', false)) {
return $retvars;
}
/**
* Convert the loaded image to a PNG and then return a structure for the PDF creator.
* This function requires GD library and write access to the directory defined on K_PATH_CACHE constant.
* @param string $file Image file name.
* @param image $image Image object.
* return image PNG image object.
* @access protected
* @since 4.9.016 (2010-04-20)
*/
protected function _toPNG($image) {
$tempname = tempnam(K_PATH_CACHE, 'jpg_');
imagepng($image, $tempname);
imagedestroy($image);
$retvars = $this->_parsepng($tempname);
// tidy up by removing temporary image
unlink($tempname);
return $retvars;
}
/**
* Set the transparency for the given GD image.
* @param image $new_image GD image object
* @param image $image GD image object.
* return GD image object.
* @access protected
* @since 4.9.016 (2010-04-20)
*/
protected function _setGDImageTransparency($new_image, $image) { // DEBUG
// transparency index
$tid = imagecolortransparent($image);
// default transparency color
$tcol = array('red' => 255, 'green' => 255, 'blue' => 255);
if ($tid >= 0) {
// get the colors for the transparency index
$tcol = imagecolorsforindex($image, $tid);
}
$tid = imagecolorallocate($new_image, $tcol['red'], $tcol['green'], $tcol['blue']);
imagefill($new_image, 0, 0, $tid);
imagecolortransparent($new_image, $tid);
return $new_image;
}
/**
* Extract info from a JPEG file without using the GD library.
* @param string $file image file to parse