From 4c0e0ca17946e1a7085e045f7238060d5a7c254d Mon Sep 17 00:00:00 2001 From: Dennis Eichhorn Date: Wed, 2 Aug 2023 09:34:42 +0000 Subject: [PATCH] bug fixes --- tcpdf/include/tcpdf_images.php | 14 +++++++------- tcpdf/tcpdf.php | 12 ++++++------ 2 files changed, 13 insertions(+), 13 deletions(-) diff --git a/tcpdf/include/tcpdf_images.php b/tcpdf/include/tcpdf_images.php index 877d575..854c776 100755 --- a/tcpdf/include/tcpdf_images.php +++ b/tcpdf/include/tcpdf_images.php @@ -54,7 +54,7 @@ class TCPDF_IMAGES { * Array of hinheritable SVG properties. * @since 5.0.000 (2010-05-02) * @public static - * + * * @var string[] */ public static $svginheritprop = ['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']; @@ -88,9 +88,9 @@ class TCPDF_IMAGES { /** * Set the transparency for the given GD image. - * @param resource $new_image GD image object - * @param resource $image GD image object - * @return resource GD image object $new_image + * @param \GdImage $new_image GD image object + * @param \GdImage $image GD image object + * @return \GdImage GD image object $new_image * @since 4.9.016 (2010-04-20) * @public static */ @@ -113,7 +113,7 @@ class TCPDF_IMAGES { /** * 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 resource $image image object + * @param \GdImage $image image object * @param string $tempfile Temporary file name. * return image PNG image object. * @since 4.9.016 (2010-04-20) @@ -121,7 +121,7 @@ class TCPDF_IMAGES { */ public static function _toPNG($image, $tempfile) { // turn off interlaced mode - \imageinterlace($image, 0); + \imageinterlace($image, null); // create temporary PNG image \imagepng($image, $tempfile); // remove image from memory @@ -136,7 +136,7 @@ class TCPDF_IMAGES { /** * 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 resource $image image object + * @param \GdImage $image image object * @param int $quality JPEG quality * @param string $tempfile Temporary file name. * return array|false image JPEG image object. diff --git a/tcpdf/tcpdf.php b/tcpdf/tcpdf.php index 61b10fa..29dfd6d 100755 --- a/tcpdf/tcpdf.php +++ b/tcpdf/tcpdf.php @@ -7044,8 +7044,8 @@ class TCPDF { // fit the image on available space list($w, $h, $x, $y) = $this->fitBlock($w, $h, $x, $y, $fitonpage); // calculate new minimum dimensions in pixels - $neww = \round($w * $this->k * $dpi / $this->dpi); - $newh = \round($h * $this->k * $dpi / $this->dpi); + $neww = (int) \round($w * $this->k * $dpi / $this->dpi); + $newh = (int) \round($h * $this->k * $dpi / $this->dpi); // check if resize is necessary (resize is used only to reduce the image) $newsize = ($neww * $newh); $pixsize = ($pixw * $pixh); @@ -7957,11 +7957,11 @@ class TCPDF { $ratio = \preg_replace('/[^0-9\.]/', '', $ratio); $ratio = (float) $ratio; if ($type == 'u') { - $chrdiff = \floor(($diff + 12) * $ratio); + $chrdiff = (int) \floor(($diff + 12) * $ratio); $shift = \str_repeat(' ', $chrdiff); $shift = TCPDF_FONTS::UTF8ToUTF16BE($shift, false, $this->isunicode, $this->CurrentFont); } else { - $chrdiff = \floor(($diff + 11) * $ratio); + $chrdiff = (int) \floor(($diff + 11) * $ratio); $shift = \str_repeat(' ', $chrdiff); } $page = \str_replace($aa, $shift, $page); @@ -15655,7 +15655,7 @@ class TCPDF { $gvars = $this->getGraphicVars(); // create new barcode object $barcodeobj = new TCPDF2DBarcode($code, $type); - $arrcode = $barcodeobj->getBarcodeArrayArray(); + $arrcode = $barcodeobj->getBarcodeArray(); if (empty($arrcode) || !isset($arrcode['num_rows']) || ($arrcode['num_rows'] == 0) || !isset($arrcode['num_cols']) || ($arrcode['num_cols'] == 0)) { $this->Error('Error in 2D barcode string'); } @@ -18035,7 +18035,7 @@ Putting 1 is equivalent to putting 0 and calling Ln() just after. Default value: $newpmid = '[('.\str_replace(\chr(0).\chr(32), ') '.\sprintf('%F', $spacew).' (', $replace).')]'; $pos = \strpos($pmid, $pmatch, $pos); if ($pos !== false) { - $pmid = sub\str_replace($pmid, $newpmid, $pos, \strlen($pmatch)); + $pmid = \substr_replace($pmid, $newpmid, $pos, \strlen($pmatch)); } ++$pos; }