mirror of
https://github.com/vdm-io/tcpdf.git
synced 2025-02-03 01:18:24 +00:00
5.9.209 (2013-03-15)
- Image method was improved.
This commit is contained in:
parent
3e49de8be6
commit
facbc7b253
@ -1,3 +1,6 @@
|
|||||||
|
5.9.209 (2013-03-15)
|
||||||
|
- Image method was improved.
|
||||||
|
|
||||||
5.9.208 (2013-03-15)
|
5.9.208 (2013-03-15)
|
||||||
- objclone fuction was patched to support old imagick extensions.
|
- objclone fuction was patched to support old imagick extensions.
|
||||||
- tcpdf_parser was improved to support Cross-Reference Streams and large streams.
|
- tcpdf_parser was improved to support Cross-Reference Streams and large streams.
|
||||||
|
@ -8,7 +8,7 @@ http://sourceforge.net/donate/index.php?group_id=128076
|
|||||||
------------------------------------------------------------
|
------------------------------------------------------------
|
||||||
|
|
||||||
Name: TCPDF
|
Name: TCPDF
|
||||||
Version: 5.9.208
|
Version: 5.9.209
|
||||||
Release date: 2013-03-15
|
Release date: 2013-03-15
|
||||||
Author: Nicola Asuni
|
Author: Nicola Asuni
|
||||||
|
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "tecnick.com/tcpdf",
|
"name": "tecnick.com/tcpdf",
|
||||||
"version": "5.9.208",
|
"version": "5.9.209",
|
||||||
"homepage": "http://www.tcpdf.org/",
|
"homepage": "http://www.tcpdf.org/",
|
||||||
"type": "library",
|
"type": "library",
|
||||||
"description": "TCPDF is a PHP class for generating PDF documents.",
|
"description": "TCPDF is a PHP class for generating PDF documents.",
|
||||||
|
68
tcpdf.php
68
tcpdf.php
@ -1,7 +1,7 @@
|
|||||||
<?php
|
<?php
|
||||||
//============================================================+
|
//============================================================+
|
||||||
// File name : tcpdf.php
|
// File name : tcpdf.php
|
||||||
// Version : 5.9.208
|
// Version : 5.9.209
|
||||||
// Begin : 2002-08-03
|
// Begin : 2002-08-03
|
||||||
// Last Update : 2013-03-14
|
// Last Update : 2013-03-14
|
||||||
// Author : Nicola Asuni - Tecnick.com LTD - Manor Coach House, Church Hill, Aldershot, Hants, GU12 4RQ, UK - www.tecnick.com - info@tecnick.com
|
// Author : Nicola Asuni - Tecnick.com LTD - Manor Coach House, Church Hill, Aldershot, Hants, GU12 4RQ, UK - www.tecnick.com - info@tecnick.com
|
||||||
@ -7963,17 +7963,6 @@ class TCPDF {
|
|||||||
if ($file[0] === '@') {
|
if ($file[0] === '@') {
|
||||||
// image from string
|
// image from string
|
||||||
$imgdata = substr($file, 1);
|
$imgdata = substr($file, 1);
|
||||||
$file = $this->getObjFilename('img');
|
|
||||||
$fp = fopen($file, 'w');
|
|
||||||
fwrite($fp, $imgdata);
|
|
||||||
fclose($fp);
|
|
||||||
unset($imgdata);
|
|
||||||
$imsize = @getimagesize($file);
|
|
||||||
if ($imsize === FALSE) {
|
|
||||||
unlink($file);
|
|
||||||
} else {
|
|
||||||
$this->cached_files[] = $file;
|
|
||||||
}
|
|
||||||
} else { // image file
|
} else { // image file
|
||||||
if ($file{0} === '*') {
|
if ($file{0} === '*') {
|
||||||
// image as external stream
|
// image as external stream
|
||||||
@ -7989,7 +7978,7 @@ class TCPDF {
|
|||||||
// get image dimensions
|
// get image dimensions
|
||||||
$imsize = @getimagesize($file);
|
$imsize = @getimagesize($file);
|
||||||
} else {
|
} else {
|
||||||
$imsize = false;
|
$imsize = FALSE;
|
||||||
}
|
}
|
||||||
if ($imsize === FALSE) {
|
if ($imsize === FALSE) {
|
||||||
if (function_exists('curl_init')) {
|
if (function_exists('curl_init')) {
|
||||||
@ -8009,30 +7998,27 @@ class TCPDF {
|
|||||||
curl_setopt($cs, CURLOPT_USERAGENT, 'TCPDF');
|
curl_setopt($cs, CURLOPT_USERAGENT, 'TCPDF');
|
||||||
$imgdata = curl_exec($cs);
|
$imgdata = curl_exec($cs);
|
||||||
curl_close($cs);
|
curl_close($cs);
|
||||||
if ($imgdata !== FALSE) {
|
} else {
|
||||||
// copy image to cache
|
$imgdata = @file_get_contents($file);
|
||||||
$file = $this->getObjFilename('img');
|
|
||||||
$fp = fopen($file, 'w');
|
|
||||||
fwrite($fp, $imgdata);
|
|
||||||
fclose($fp);
|
|
||||||
unset($imgdata);
|
|
||||||
$imsize = @getimagesize($file);
|
|
||||||
if ($imsize === FALSE) {
|
|
||||||
unlink($file);
|
|
||||||
} else {
|
|
||||||
$this->cached_files[] = $file;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} elseif (($w > 0) AND ($h > 0)) {
|
|
||||||
// get measures from specified data
|
|
||||||
$pw = $this->getHTMLUnitToUnits($w, 0, $this->pdfunit, true) * $this->imgscale * $this->k;
|
|
||||||
$ph = $this->getHTMLUnitToUnits($h, 0, $this->pdfunit, true) * $this->imgscale * $this->k;
|
|
||||||
$imsize = array($pw, $ph);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (isset($imgdata) AND ($imgdata !== FALSE)) {
|
||||||
|
// copy image to cache
|
||||||
|
$file = $this->getObjFilename('img');
|
||||||
|
$fp = fopen($file, 'w');
|
||||||
|
fwrite($fp, $imgdata);
|
||||||
|
fclose($fp);
|
||||||
|
unset($imgdata);
|
||||||
|
$imsize = @getimagesize($file);
|
||||||
|
if ($imsize === FALSE) {
|
||||||
|
unlink($file);
|
||||||
|
} else {
|
||||||
|
$this->cached_files[] = $file;
|
||||||
|
}
|
||||||
|
}
|
||||||
if ($imsize === FALSE) {
|
if ($imsize === FALSE) {
|
||||||
if (substr($file, 0, -34) == K_PATH_CACHE.'msk') { // mask file
|
if (($w > 0) AND ($h > 0)) {
|
||||||
// get measures from specified data
|
// get measures from specified data
|
||||||
$pw = $this->getHTMLUnitToUnits($w, 0, $this->pdfunit, true) * $this->imgscale * $this->k;
|
$pw = $this->getHTMLUnitToUnits($w, 0, $this->pdfunit, true) * $this->imgscale * $this->k;
|
||||||
$ph = $this->getHTMLUnitToUnits($h, 0, $this->pdfunit, true) * $this->imgscale * $this->k;
|
$ph = $this->getHTMLUnitToUnits($h, 0, $this->pdfunit, true) * $this->imgscale * $this->k;
|
||||||
@ -8247,7 +8233,7 @@ class TCPDF {
|
|||||||
}
|
}
|
||||||
$img->setCompressionQuality($this->jpeg_quality);
|
$img->setCompressionQuality($this->jpeg_quality);
|
||||||
$img->setImageFormat('jpeg');
|
$img->setImageFormat('jpeg');
|
||||||
$tempname = tempnam(K_PATH_CACHE, 'jpg_');
|
$tempname = $this->getObjFilename('jpg');
|
||||||
$img->writeImage($tempname);
|
$img->writeImage($tempname);
|
||||||
$info = $this->_parsejpeg($tempname);
|
$info = $this->_parsejpeg($tempname);
|
||||||
unlink($tempname);
|
unlink($tempname);
|
||||||
@ -8398,7 +8384,7 @@ class TCPDF {
|
|||||||
* @protected
|
* @protected
|
||||||
*/
|
*/
|
||||||
protected function _toJPEG($image) {
|
protected function _toJPEG($image) {
|
||||||
$tempname = tempnam(K_PATH_CACHE, 'jpg_');
|
$tempname = $this->getObjFilename('jpg');
|
||||||
imagejpeg($image, $tempname, $this->jpeg_quality);
|
imagejpeg($image, $tempname, $this->jpeg_quality);
|
||||||
imagedestroy($image);
|
imagedestroy($image);
|
||||||
$retvars = $this->_parsejpeg($tempname);
|
$retvars = $this->_parsejpeg($tempname);
|
||||||
@ -8417,7 +8403,7 @@ class TCPDF {
|
|||||||
*/
|
*/
|
||||||
protected function _toPNG($image) {
|
protected function _toPNG($image) {
|
||||||
// set temporary image file name
|
// set temporary image file name
|
||||||
$tempname = tempnam(K_PATH_CACHE, 'jpg_');
|
$tempname = $this->getObjFilename('png');
|
||||||
// turn off interlaced mode
|
// turn off interlaced mode
|
||||||
imageinterlace($image, 0);
|
imageinterlace($image, 0);
|
||||||
// create temporary PNG image
|
// create temporary PNG image
|
||||||
@ -9038,7 +9024,7 @@ class TCPDF {
|
|||||||
$byterange .= str_repeat(' ', ($byterange_string_len - strlen($byterange)));
|
$byterange .= str_repeat(' ', ($byterange_string_len - strlen($byterange)));
|
||||||
$pdfdoc = str_replace($this->byterange_string, $byterange, $pdfdoc);
|
$pdfdoc = str_replace($this->byterange_string, $byterange, $pdfdoc);
|
||||||
// write the document to a temporary folder
|
// write the document to a temporary folder
|
||||||
$tempdoc = tempnam(K_PATH_CACHE, 'tmppdf_');
|
$tempdoc = $this->getObjFilename('tmppdf');
|
||||||
$f = fopen($tempdoc, 'wb');
|
$f = fopen($tempdoc, 'wb');
|
||||||
if (!$f) {
|
if (!$f) {
|
||||||
$this->Error('Unable to create temporary file: '.$tempdoc);
|
$this->Error('Unable to create temporary file: '.$tempdoc);
|
||||||
@ -9047,7 +9033,7 @@ class TCPDF {
|
|||||||
fwrite($f, $pdfdoc, $pdfdoc_length);
|
fwrite($f, $pdfdoc, $pdfdoc_length);
|
||||||
fclose($f);
|
fclose($f);
|
||||||
// get digital signature via openssl library
|
// get digital signature via openssl library
|
||||||
$tempsign = tempnam(K_PATH_CACHE, 'tmpsig_');
|
$tempsign = $this->getObjFilename('tmpsig');
|
||||||
if (empty($this->signature_data['extracerts'])) {
|
if (empty($this->signature_data['extracerts'])) {
|
||||||
openssl_pkcs7_sign($tempdoc, $tempsign, $this->signature_data['signcert'], array($this->signature_data['privkey'], $this->signature_data['password']), array(), PKCS7_BINARY | PKCS7_DETACHED);
|
openssl_pkcs7_sign($tempdoc, $tempsign, $this->signature_data['signcert'], array($this->signature_data['privkey'], $this->signature_data['password']), array(), PKCS7_BINARY | PKCS7_DETACHED);
|
||||||
} else {
|
} else {
|
||||||
@ -14749,7 +14735,7 @@ class TCPDF {
|
|||||||
// envelope data
|
// envelope data
|
||||||
$envelope = $seed.$pkpermissions;
|
$envelope = $seed.$pkpermissions;
|
||||||
// write the envelope data to a temporary file
|
// write the envelope data to a temporary file
|
||||||
$tempkeyfile = tempnam(K_PATH_CACHE, 'tmpkey_');
|
$tempkeyfile = $this->getObjFilename('tmpkey');
|
||||||
$f = fopen($tempkeyfile, 'wb');
|
$f = fopen($tempkeyfile, 'wb');
|
||||||
if (!$f) {
|
if (!$f) {
|
||||||
$this->Error('Unable to create temporary key file: '.$tempkeyfile);
|
$this->Error('Unable to create temporary key file: '.$tempkeyfile);
|
||||||
@ -14757,7 +14743,7 @@ class TCPDF {
|
|||||||
$envelope_length = strlen($envelope);
|
$envelope_length = strlen($envelope);
|
||||||
fwrite($f, $envelope, $envelope_length);
|
fwrite($f, $envelope, $envelope_length);
|
||||||
fclose($f);
|
fclose($f);
|
||||||
$tempencfile = tempnam(K_PATH_CACHE, 'tmpenc_');
|
$tempencfile = $this->getObjFilename('tmpenc');
|
||||||
if (!openssl_pkcs7_encrypt($tempkeyfile, $tempencfile, $pubkey['c'], array(), PKCS7_BINARY | PKCS7_DETACHED)) {
|
if (!openssl_pkcs7_encrypt($tempkeyfile, $tempencfile, $pubkey['c'], array(), PKCS7_BINARY | PKCS7_DETACHED)) {
|
||||||
$this->Error('Unable to encrypt the file: '.$tempkeyfile);
|
$this->Error('Unable to encrypt the file: '.$tempkeyfile);
|
||||||
}
|
}
|
||||||
@ -25960,7 +25946,7 @@ Putting 1 is equivalent to putting 0 and calling Ln() just after. Default value:
|
|||||||
* @protected
|
* @protected
|
||||||
*/
|
*/
|
||||||
protected function getObjFilename($name) {
|
protected function getObjFilename($name) {
|
||||||
return tempnam(K_PATH_CACHE, $name.'_');
|
return tempnam(K_PATH_CACHE, $name.'_'.$this->file_id.'_');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
x
Reference in New Issue
Block a user