* Don't force rendering in File::getThumbnail(). The old code (pre-filerepo) required...
authorTim Starling <tstarling@users.mediawiki.org>
Fri, 5 Sep 2008 04:23:24 +0000 (04:23 +0000)
committerTim Starling <tstarling@users.mediawiki.org>
Fri, 5 Sep 2008 04:23:24 +0000 (04:23 +0000)
* Use File::transform() in the core instead of the deprecated File::getThumbnail().

includes/api/ApiQueryImageInfo.php
includes/filerepo/File.php
includes/specials/SpecialFileDuplicateSearch.php
includes/specials/SpecialSearch.php

index 99201e2..6f5c5e2 100644 (file)
@@ -123,12 +123,12 @@ class ApiQueryImageInfo extends ApiQueryBase {
                }
                if( isset( $prop['url'] ) ) {
                        if( !is_null( $scale ) && !$file->isOld() ) {
-                               $thumb = $file->getThumbnail( $scale['width'], $scale['height'] );
-                               if( $thumb )
+                               $mto = $file->transform( array( 'width' => $scale['width'], 'height' => $scale['height'] ) );
+                               if( $mto && !$mto->isError() )
                                {
-                                       $vals['thumburl'] = wfExpandUrl( $thumb->getURL() );
-                                       $vals['thumbwidth'] = $thumb->getWidth();
-                                       $vals['thumbheight'] = $thumb->getHeight();
+                                       $vals['thumburl'] = $mto->getUrl();
+                                       $vals['thumbwidth'] = $mto->getWidth();
+                                       $vals['thumbheight'] = $mto->getHeight();
                                }
                        }
                        $vals['url'] = $file->getFullURL();
index 8ae51f0..c22d00d 100644 (file)
@@ -506,8 +506,7 @@ abstract class File {
         *
         * @param integer $width        maximum width of the generated thumbnail
         * @param integer $height       maximum height of the image (optional)
-        * @param boolean $render       True to render the thumbnail if it doesn't exist,
-        *                              false to just return the URL
+        * @param boolean $render       Deprecated
         *
         * @return ThumbnailImage or null on failure
         *
@@ -518,7 +517,6 @@ abstract class File {
                if ( $height != -1 ) {
                        $params['height'] = $height;
                }
-               $flags = $render ? self::RENDER_NOW : 0;
                return $this->transform( $params, $flags );
        }
 
index 5236ca2..98454d8 100644 (file)
@@ -100,7 +100,7 @@ function wfSpecialFileDuplicateSearch( $par = null ) {
                # Show a thumbnail of the file
                $img = wfFindFile( $title );
                if ( $img ) {
-                       $thumb = $img->getThumbnail( 120, 120 );
+                       $thumb = $img->transform( array( 'width' => 120, 'height' => 120 ) );
                        if( $thumb ) {
                                $wgOut->addHTML( '<div style="float:' . $align . '" id="mw-fileduplicatesearch-icon">' .
                                        $thumb->toHtml( array( 'desc-link' => false ) ) . '<br />' .
index 815946b..3ee0bf1 100644 (file)
@@ -448,7 +448,7 @@ class SpecialSearch {
                if( $t->getNamespace() == NS_IMAGE ) {
                        $img = wfFindFile( $t );
                        if( $img ) {
-                               $thumb = $img->getThumbnail( 120, 120 );
+                               $thumb = $img->transform( array( 'width' => 120, 'height' => 120 ) );
                                if( $thumb ) {
                                        $desc = $img->getShortDesc();
                                        wfProfileOut( $fname );