From 79e25cef14a704fccf9e0f70a0f33397282226ec Mon Sep 17 00:00:00 2001 From: Brion Vibber Date: Fri, 10 Nov 2006 13:23:47 +0000 Subject: [PATCH] * Approximate height for client-side scaling fallback instead of passing -1 into the HTML output. height="-1" was getting into the tags for (for example) very large PNGs not thumbnailed server-side due to the max image size limit --- RELEASE-NOTES | 2 ++ includes/Linker.php | 6 ++++++ 2 files changed, 8 insertions(+) diff --git a/RELEASE-NOTES b/RELEASE-NOTES index e9f751da88..bdc990136f 100644 --- a/RELEASE-NOTES +++ b/RELEASE-NOTES @@ -160,6 +160,8 @@ it from source control: http://www.mediawiki.org/wiki/Download_from_SVN * Fix regression in Special:Undelete for revisions deleted under MediaWiki 1.4 with compression or legacy encoding * (bug 6737) Fixes for MySQL 5 schema in strict mode +* Approximate height for client-side scaling fallback instead of passing -1 + into the HTML output. == Languages updated == diff --git a/includes/Linker.php b/includes/Linker.php index f492f5733a..84fe82bb93 100644 --- a/includes/Linker.php +++ b/includes/Linker.php @@ -537,6 +537,8 @@ class Linker { $url = $thumb->getUrl(); } else { $error = htmlspecialchars( $img->getLastError() ); + // Do client-side scaling... + $height = intval( $img->getHeight() * $width / $img->getWidth() ); } } } else { @@ -633,6 +635,10 @@ class Linker { if( $thumbUrl == '' ) { // Couldn't generate thumbnail? Scale the image client-side. $thumbUrl = $img->getViewURL(); + if( $boxheight == -1 ) { + // Approximate... + $boxheight = intval( $height * $boxwidth / $width ); + } } if ( $error ) { $s .= htmlspecialchars( $error ); -- 2.20.1