* Approximate height for client-side scaling fallback instead of passing -1 into...
authorBrion Vibber <brion@users.mediawiki.org>
Fri, 10 Nov 2006 13:23:47 +0000 (13:23 +0000)
committerBrion Vibber <brion@users.mediawiki.org>
Fri, 10 Nov 2006 13:23:47 +0000 (13:23 +0000)
height="-1" was getting into the <img> tags for (for example) very large PNGs not thumbnailed server-side due to the max image size limit

RELEASE-NOTES
includes/Linker.php

index e9f751d..bdc9901 100644 (file)
@@ -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 ==
index f492f57..84fe82b 100644 (file)
@@ -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 );