From fec6d65d96e4e76e987f080f402ca30aa8369736 Mon Sep 17 00:00:00 2001 From: Florian Schirmer Date: Thu, 21 Jan 2021 14:28:25 +0100 Subject: [PATCH 1/2] Fix BLOB JPG preview thumbnail Signed-off-by: Florian Schirmer --- .../Controllers/TransformationWrapperController.php | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/libraries/classes/Controllers/TransformationWrapperController.php b/libraries/classes/Controllers/TransformationWrapperController.php index e2c5e11e23..e12c811106 100644 --- a/libraries/classes/Controllers/TransformationWrapperController.php +++ b/libraries/classes/Controllers/TransformationWrapperController.php @@ -24,6 +24,7 @@ use function imagesx; use function imagesy; use function in_array; use function intval; +use function round; use function str_replace; use function stripos; use function substr; @@ -194,11 +195,11 @@ class TransformationWrapperController extends AbstractController $ratioHeight = $srcHeight / $_REQUEST['newHeight']; if ($ratioWidth < $ratioHeight) { - $destWidth = $srcWidth / $ratioHeight; - $destHeight = $_REQUEST['newHeight']; + $destWidth = intval(round($srcWidth / $ratioHeight)); + $destHeight = intval($_REQUEST['newHeight']); } else { - $destWidth = $_REQUEST['newWidth']; - $destHeight = $srcHeight / $ratioWidth; + $destWidth = intval($_REQUEST['newWidth']); + $destHeight = intval(round($srcHeight / $ratioWidth)); } if ($_REQUEST['resize']) { From ed36df4116b4c51190f29c6512ba9e5c230208b0 Mon Sep 17 00:00:00 2001 From: William Desportes Date: Fri, 22 Jan 2021 23:49:02 +0100 Subject: [PATCH 2/2] Fix "Uncaught TypeError: Argument 1 passed to PhpMyAdmin\Core::downloadHeader()" Fatal error: Uncaught TypeError: Argument 1 passed to PhpMyAdmin\Core::downloadHeader() must be of the type string, null given, called in libraries/classes/Controllers/TransformationWrapperController.php on line 171 and defined in libraries/classes/Core.php:617 Stack trace: #0 libraries/classes/Controllers/TransformationWrapperController.php(171): PhpMyAdmin\Core::downloadHeader(NULL, 'application/oct...') #1 libraries/classes/Routing.php(92): PhpMyAdmin\Controllers\TransformationWrapperController->index(Array) #2 index.php(18): PhpMyAdmin\Routing::callControllerForRoute('/transformation...', Object(FastRoute\Dispatcher\GroupCountBased), Object(Symfony\Component\DependencyInjection\ContainerBuilder)) #3 {main} thrown in libraries/classes/Core.php on line 617 Signed-off-by: William Desportes --- .../classes/Controllers/TransformationWrapperController.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libraries/classes/Controllers/TransformationWrapperController.php b/libraries/classes/Controllers/TransformationWrapperController.php index e12c811106..acf92db0c1 100644 --- a/libraries/classes/Controllers/TransformationWrapperController.php +++ b/libraries/classes/Controllers/TransformationWrapperController.php @@ -168,10 +168,10 @@ class TransformationWrapperController extends AbstractController . ($mime_options['charset'] ?? ''); } - Core::downloadHeader($cn, $mime_type); + Core::downloadHeader($cn ?? '', $mime_type ?? ''); if (! isset($_REQUEST['resize'])) { - if (stripos($mime_type, 'html') === false) { + if (stripos($mime_type ?? '', 'html') === false) { echo $row[$transform_key]; } else { echo htmlspecialchars($row[$transform_key]);