From 869ab2651b65f76c2799a13764bc7f4185e4b775 Mon Sep 17 00:00:00 2001
From: Roy Van Ginneken <roy.vanginneken@intracto.com>
Date: Sat, 27 Mar 2021 10:17:09 +0100
Subject: [PATCH] Fix image file type for urls with query params (#287)

Co-authored-by: Nicola Asuni <nicolaasuni@users.noreply.github.com>
---
 include/tcpdf_images.php | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/include/tcpdf_images.php b/include/tcpdf_images.php
index 5e504f2..a3d61b8 100644
--- a/include/tcpdf_images.php
+++ b/include/tcpdf_images.php
@@ -77,10 +77,7 @@ class TCPDF_IMAGES {
 			}
 		}
 		if (empty($type)) {
-			$fileinfo = pathinfo($imgfile);
-			if (isset($fileinfo['extension']) AND (!TCPDF_STATIC::empty_string($fileinfo['extension']))) {
-				$type = strtolower(trim($fileinfo['extension']));
-			}
+            $type = strtolower(trim(pathinfo(parse_url($imgfile, PHP_URL_PATH), PATHINFO_EXTENSION)));
 		}
 		if ($type == 'jpg') {
 			$type = 'jpeg';