mirror of
https://github.com/vdm-io/tcpdf.git
synced 2025-01-23 12:28:25 +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)
|
||||
- objclone fuction was patched to support old imagick extensions.
|
||||
- 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
|
||||
Version: 5.9.208
|
||||
Version: 5.9.209
|
||||
Release date: 2013-03-15
|
||||
Author: Nicola Asuni
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "tecnick.com/tcpdf",
|
||||
"version": "5.9.208",
|
||||
"version": "5.9.209",
|
||||
"homepage": "http://www.tcpdf.org/",
|
||||
"type": "library",
|
||||
"description": "TCPDF is a PHP class for generating PDF documents.",
|
||||
|
68
tcpdf.php
68
tcpdf.php
@ -1,7 +1,7 @@
|
||||
<?php
|
||||
//============================================================+
|
||||
// File name : tcpdf.php
|
||||
// Version : 5.9.208
|
||||
// Version : 5.9.209
|
||||
// Begin : 2002-08-03
|
||||
// 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
|
||||
@ -7963,17 +7963,6 @@ class TCPDF {
|
||||
if ($file[0] === '@') {
|
||||
// image from string
|
||||
$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
|
||||
if ($file{0} === '*') {
|
||||
// image as external stream
|
||||
@ -7989,7 +7978,7 @@ class TCPDF {
|
||||
// get image dimensions
|
||||
$imsize = @getimagesize($file);
|
||||
} else {
|
||||
$imsize = false;
|
||||
$imsize = FALSE;
|
||||
}
|
||||
if ($imsize === FALSE) {
|
||||
if (function_exists('curl_init')) {
|
||||
@ -8009,30 +7998,27 @@ class TCPDF {
|
||||
curl_setopt($cs, CURLOPT_USERAGENT, 'TCPDF');
|
||||
$imgdata = curl_exec($cs);
|
||||
curl_close($cs);
|
||||
if ($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;
|
||||
}
|
||||
}
|
||||
} 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);
|
||||
} else {
|
||||
$imgdata = @file_get_contents($file);
|
||||
}
|
||||
}
|
||||
}
|
||||
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 (substr($file, 0, -34) == K_PATH_CACHE.'msk') { // mask file
|
||||
if (($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;
|
||||
@ -8247,7 +8233,7 @@ class TCPDF {
|
||||
}
|
||||
$img->setCompressionQuality($this->jpeg_quality);
|
||||
$img->setImageFormat('jpeg');
|
||||
$tempname = tempnam(K_PATH_CACHE, 'jpg_');
|
||||
$tempname = $this->getObjFilename('jpg');
|
||||
$img->writeImage($tempname);
|
||||
$info = $this->_parsejpeg($tempname);
|
||||
unlink($tempname);
|
||||
@ -8398,7 +8384,7 @@ class TCPDF {
|
||||
* @protected
|
||||
*/
|
||||
protected function _toJPEG($image) {
|
||||
$tempname = tempnam(K_PATH_CACHE, 'jpg_');
|
||||
$tempname = $this->getObjFilename('jpg');
|
||||
imagejpeg($image, $tempname, $this->jpeg_quality);
|
||||
imagedestroy($image);
|
||||
$retvars = $this->_parsejpeg($tempname);
|
||||
@ -8417,7 +8403,7 @@ class TCPDF {
|
||||
*/
|
||||
protected function _toPNG($image) {
|
||||
// set temporary image file name
|
||||
$tempname = tempnam(K_PATH_CACHE, 'jpg_');
|
||||
$tempname = $this->getObjFilename('png');
|
||||
// turn off interlaced mode
|
||||
imageinterlace($image, 0);
|
||||
// create temporary PNG image
|
||||
@ -9038,7 +9024,7 @@ class TCPDF {
|
||||
$byterange .= str_repeat(' ', ($byterange_string_len - strlen($byterange)));
|
||||
$pdfdoc = str_replace($this->byterange_string, $byterange, $pdfdoc);
|
||||
// write the document to a temporary folder
|
||||
$tempdoc = tempnam(K_PATH_CACHE, 'tmppdf_');
|
||||
$tempdoc = $this->getObjFilename('tmppdf');
|
||||
$f = fopen($tempdoc, 'wb');
|
||||
if (!$f) {
|
||||
$this->Error('Unable to create temporary file: '.$tempdoc);
|
||||
@ -9047,7 +9033,7 @@ class TCPDF {
|
||||
fwrite($f, $pdfdoc, $pdfdoc_length);
|
||||
fclose($f);
|
||||
// get digital signature via openssl library
|
||||
$tempsign = tempnam(K_PATH_CACHE, 'tmpsig_');
|
||||
$tempsign = $this->getObjFilename('tmpsig');
|
||||
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);
|
||||
} else {
|
||||
@ -14749,7 +14735,7 @@ class TCPDF {
|
||||
// envelope data
|
||||
$envelope = $seed.$pkpermissions;
|
||||
// write the envelope data to a temporary file
|
||||
$tempkeyfile = tempnam(K_PATH_CACHE, 'tmpkey_');
|
||||
$tempkeyfile = $this->getObjFilename('tmpkey');
|
||||
$f = fopen($tempkeyfile, 'wb');
|
||||
if (!$f) {
|
||||
$this->Error('Unable to create temporary key file: '.$tempkeyfile);
|
||||
@ -14757,7 +14743,7 @@ class TCPDF {
|
||||
$envelope_length = strlen($envelope);
|
||||
fwrite($f, $envelope, $envelope_length);
|
||||
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)) {
|
||||
$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 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