PluginProbe
GiveWP – Donation Plugin and Fundraising Platform / 4.17.0
GiveWP – Donation Plugin and Fundraising Platform v4.17.0
4.17.0 4.16.9 4.16.8.1 4.16.8 4.16.7.2 4.16.7.1 4.16.7 4.16.6.1 4.16.6 4.16.5.1 4.16.5 4.16.4 4.16.3 4.16.2 4.16.1 4.16.0 4.15.5 4.15.4 4.15.3 4.15.2 4.15.1 4.15.0 2.3.0 2.3.1 2.3.2 All 256 releases
← All changes | vendor/tecnickcom/tcpdf/include/tcpdf_images.php +32 -33 2.3.2 → 4.17.0 View file →
@@ -4,11 +4,11 @@
4 4 // Version : 1.0.005
5 5 // Begin : 2002-08-03
6 6 // Last Update : 2014-11-15
7 7 // Author : Nicola Asuni - Tecnick.com LTD - www.tecnick.com - [email protected]
8 -// License : GNU-LGPL v3 (http://www.gnu.org/copyleft/lesser.html)
8 +// License : GNU-LGPL v3 (https://www.gnu.org/copyleft/lesser.html)
9 9 // -------------------------------------------------------------------
10 -// Copyright (C) 2002-2014 Nicola Asuni - Tecnick.com LTD
10 +// Copyright (C) 2002-2026 Nicola Asuni - Tecnick.com LTD
11 11 //
12 12 // This file is part of TCPDF software library.
13 13 //
14 14 // TCPDF is free software: you can redistribute it and/or modify it
@@ -54,8 +54,10 @@
54 54 /**
55 55 * Array of hinheritable SVG properties.
56 56 * @since 5.0.000 (2010-05-02)
57 57 * @public static
58 + *
59 + * @var string[]
58 60 */
59 61 public static $svginheritprop = array('clip-rule', 'color', 'color-interpolation', 'color-interpolation-filters', 'color-profile', 'color-rendering', 'cursor', 'direction', 'display', 'fill', 'fill-opacity', 'fill-rule', 'font', 'font-family', 'font-size', 'font-size-adjust', 'font-stretch', 'font-style', 'font-variant', 'font-weight', 'glyph-orientation-horizontal', 'glyph-orientation-vertical', 'image-rendering', 'kerning', 'letter-spacing', 'marker', 'marker-end', 'marker-mid', 'marker-start', 'pointer-events', 'shape-rendering', 'stroke', 'stroke-dasharray', 'stroke-dashoffset', 'stroke-linecap', 'stroke-linejoin', 'stroke-miterlimit', 'stroke-opacity', 'stroke-width', 'text-anchor', 'text-rendering', 'visibility', 'word-spacing', 'writing-mode');
60 62
61 63 // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@@ -61,10 +63,10 @@
61 63 // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
62 64
63 65 /**
64 66 * Return the image type given the file name or array returned by getimagesize() function.
65 - * @param $imgfile (string) image file name
66 - * @param $iminfo (array) array of image information returned by getimagesize() function.
67 + * @param string $imgfile image file name
68 + * @param array $iminfo array of image information returned by getimagesize() function.
67 69 * @return string image type
68 70 * @since 4.8.017 (2009-11-27)
69 71 * @public static
70 72 */
@@ -76,12 +78,9 @@
76 78 $type = strtolower(trim($mime[1]));
77 79 }
78 80 }
79 81 if (empty($type)) {
80 - $fileinfo = pathinfo($imgfile);
81 - if (isset($fileinfo['extension']) AND (!TCPDF_STATIC::empty_string($fileinfo['extension']))) {
82 - $type = strtolower(trim($fileinfo['extension']));
83 - }
82 + $type = strtolower(trim(pathinfo(parse_url($imgfile, PHP_URL_PATH), PATHINFO_EXTENSION)));
84 83 }
85 84 if ($type == 'jpg') {
86 85 $type = 'jpeg';
87 86 }
@@ -89,11 +88,11 @@
89 88 }
90 89
91 90 /**
92 91 * Set the transparency for the given GD image.
93 - * @param $new_image (image) GD image object
94 - * @param $image (image) GD image object.
95 - * return GD image object.
92 + * @param resource $new_image GD image object
93 + * @param resource $image GD image object.
94 + * @return resource GD image object $new_image
96 95 * @since 4.9.016 (2010-04-20)
97 96 * @public static
98 97 */
99 98 public static function setGDImageTransparency($new_image, $image) {
@@ -114,10 +113,10 @@
114 113
115 114 /**
116 115 * Convert the loaded image to a PNG and then return a structure for the PDF creator.
117 116 * This function requires GD library and write access to the directory defined on K_PATH_CACHE constant.
118 - * @param $image (image) Image object.
119 - * @param $tempfile (string) Temporary file name.
117 + * @param resource $image Image object.
118 + * @param string $tempfile Temporary file name.
120 119 * return image PNG image object.
121 120 * @since 4.9.016 (2010-04-20)
122 121 * @public static
123 122 */
@@ -126,9 +125,11 @@
126 125 imageinterlace($image, 0);
127 126 // create temporary PNG image
128 127 imagepng($image, $tempfile);
129 128 // remove image from memory
130 - imagedestroy($image);
129 + if (PHP_VERSION_ID < 80000) {
130 + imagedestroy($image);
131 + }
131 132 // get PNG image data
132 133 $retvars = self::_parsepng($tempfile);
133 134 // tidy up by removing temporary image
134 135 unlink($tempfile);
@@ -137,17 +138,19 @@
137 138
138 139 /**
139 140 * Convert the loaded image to a JPEG and then return a structure for the PDF creator.
140 141 * This function requires GD library and write access to the directory defined on K_PATH_CACHE constant.
141 - * @param $image (image) Image object.
142 - * @param $quality (int) JPEG quality.
143 - * @param $tempfile (string) Temporary file name.
144 - * return image JPEG image object.
142 + * @param resource $image Image object.
143 + * @param int $quality JPEG quality.
144 + * @param string $tempfile Temporary file name.
145 + * return array|false image JPEG image object.
145 146 * @public static
146 147 */
147 148 public static function _toJPEG($image, $quality, $tempfile) {
148 149 imagejpeg($image, $tempfile, $quality);
149 - imagedestroy($image);
150 + if (PHP_VERSION_ID < 80000) {
151 + imagedestroy($image);
152 + }
150 153 $retvars = self::_parsejpeg($tempfile);
151 154 // tidy up by removing temporary image
152 155 unlink($tempfile);
153 156 return $retvars;
@@ -154,20 +157,16 @@
154 157 }
155 158
156 159 /**
157 160 * Extract info from a JPEG file without using the GD library.
158 - * @param $file (string) image file to parse
159 - * @return array structure containing the image data
161 + * @param string $file image file to parse
162 + * @return array|false structure containing the image data
160 163 * @public static
161 164 */
162 165 public static function _parsejpeg($file) {
163 166 // check if is a local file
164 - if (!@file_exists($file)) {
165 - // try to encode spaces on filename
166 - $tfile = str_replace(' ', '%20', $file);
167 - if (@file_exists($tfile)) {
168 - $file = $tfile;
169 - }
167 + if (!@TCPDF_STATIC::file_exists($file)) {
168 + return false;
170 169 }
171 170 $a = getimagesize($file);
172 171 if (empty($a)) {
173 172 //Missing or incorrect image file
@@ -237,10 +236,10 @@
237 236 }
238 237
239 238 /**
240 239 * Extract info from a PNG file without using the GD library.
241 - * @param $file (string) image file to parse
242 - * @return array structure containing the image data
240 + * @param string $file image file to parse
241 + * @return array|false structure containing the image data
243 242 * @public static
244 243 */
245 244 public static function _parsepng($file) {
246 245 $f = @fopen($file, 'rb');
@@ -274,14 +273,14 @@
274 273 fclose($f);
275 274 return 'pngalpha';
276 275 }
277 276 if (ord(fread($f, 1)) != 0) {
278 - // Unknown compression method
277 + // Unknownn compression method
279 278 fclose($f);
280 279 return false;
281 280 }
282 281 if (ord(fread($f, 1)) != 0) {
283 - // Unknown filter method
282 + // Unknownn filter method
284 283 fclose($f);
285 284 return false;
286 285 }
287 286 if (ord(fread($f, 1)) != 0) {
@@ -314,9 +313,9 @@
314 313 } else { // Indexed
315 314 if ($n > 0) {
316 315 $trns = array();
317 316 for ($i = 0; $i < $n; ++ $i) {
318 - $trns[] = ord($t{$i});
317 + $trns[] = ord($t[$i]);
319 318 }
320 319 }
321 320 }
322 321 fread($f, 4);
@@ -331,9 +330,9 @@
331 330 ++$len;
332 331 }
333 332 // get compression method
334 333 if (ord(fread($f, 1)) != 0) {
335 - // Unknown filter method
334 + // Unknownn filter method
336 335 fclose($f);
337 336 return false;
338 337 }
339 338 // read ICC Color Profile