In OggHandler:
authorTim Starling <tstarling@users.mediawiki.org>
Fri, 31 Aug 2007 02:51:23 +0000 (02:51 +0000)
committerTim Starling <tstarling@users.mediawiki.org>
Fri, 31 Aug 2007 02:51:23 +0000 (02:51 +0000)
* Changed display style: added a "more" link which expands a box for player selection.
* Allow return to the still image only display.
* Fixed Java detection in IE (I hope)

Elsewhere:
* Changed MediaTransformOutput::toHtml() parameters, now accepts a single associative array with well-defined elements. Allows OggHandler to distinguish between file download links and image description links.
* Made image links consistently have an anchor tag with class=image, instead of a mixture of image and internalParse.
* Made most images have a border=0 attribute, instead of just images on the image description page. Does not appear to adversely affect display at all, it was just convenient.
* Use the image name as the title attribute for the <a> tag, when an a caption was not given by the user
* Block centering by the auto margins method in ImageGallery
* Fixed complete breakage of the thumbnail on upload conflict feature
* TODO: test DjVu

includes/ImageGallery.php
includes/ImagePage.php
includes/Linker.php
includes/MediaTransformOutput.php
includes/SpecialUpload.php
includes/filerepo/File.php
includes/media/Bitmap.php
includes/media/DjVu.php
includes/media/Generic.php
includes/media/SVG.php
maintenance/parserTests.txt

index 54aa83b..64f266f 100644 (file)
@@ -261,13 +261,14 @@ class ImageGallery
                                        . htmlspecialchars( $img->getLastError() ) . '</div>';
                        } else {
                                $vpad = floor( ( 1.25*$this->mHeights - $thumb->height ) /2 ) - 2;
-                               $linkAttribs = array(
-                                       'href' => $nt->getLocalURL(),
-                                       'title' => $nt->getPrefixedText(),
-                               );
                                        
-                               $thumbhtml = "\n\t\t\t".'<div class="thumb" style="padding: ' . $vpad . 'px 0; width: '.($this->mWidths+30).'px;">'
-                                       . $thumb->toHtml( array(), $linkAttribs ) . '</div>';
+                               $thumbhtml = "\n\t\t\t".
+                                       '<div class="thumb" style="padding: ' . $vpad . 'px 0; width: ' .($this->mWidths+30).'px;">'
+                                       # Auto-margin centering for block-level elements. Needed now that we have video
+                                       # handlers since they may emit block-level elements as opposed to simple <img> tags.
+                                       # ref http://css-discuss.incutio.com/?page=CenteringBlockElement
+                                       . '<div style="margin-left: auto; margin-right: auto; width: ' .$this->mWidths.'px;">'
+                                       . $thumb->toHtml( array( 'desc-link' => true ) ) . '</div></div>';
 
                                // Call parser transform hook
                                if ( $this->mParser && $img->getHandler() ) {
@@ -350,3 +351,4 @@ class ImageGallery
 
 } //class
 
+
index cd516d6..3cf6d0a 100644 (file)
@@ -242,14 +242,13 @@ class ImagePage extends Article {
                                        $wgOut->addHTML( '<table class="multipageimage"><tr><td>' );
                                }
 
-                               $imgAttribs = array(
-                                       'border' => 0,
-                                       'alt' => $this->img->getTitle()->getPrefixedText()
-                               );
-
                                if ( $thumbnail ) {
+                                       $options = array( 
+                                               'alt' => $this->img->getTitle()->getPrefixedText(),
+                                               'file-link' => true,
+                                       );
                                        $wgOut->addHTML( '<div class="fullImageLink" id="file">' . 
-                                               $thumbnail->toHtml( $imgAttribs, $linkAttribs ) .
+                                               $thumbnail->toHtml( $options ) .
                                                $anchorclose . '</div>' );
                                }
 
@@ -297,9 +296,9 @@ class ImagePage extends Article {
                                if ($this->img->isSafeFile()) {
                                        $icon= $this->img->iconThumb();
 
-                                       $wgOut->addHTML( '<div class="fullImageLink" id="file"><a href="' . $full_url . '">' .
-                                       $icon->toHtml() .
-                                       '</a></div>' );
+                                       $wgOut->addHTML( '<div class="fullImageLink" id="file">' .
+                                       $icon->toHtml( array( 'desc-link' => true ) ) .
+                                       '</div>' );
                                }
 
                                $showLink = true;
index 35951d5..4bc64d4 100644 (file)
@@ -566,33 +566,13 @@ class Linker {
                        $thumb = false;
                }
 
-               if ( $page ) {
-                       $query = 'page=' . urlencode( $page );
-               } else {
-                       $query = '';
-               }
-               $url = $title->getLocalURL( $query );
-               $imgAttribs = array(
-                       'alt' => $fp['alt'],
-                       'longdesc' => $url
-               );
-
-               if ( isset( $fp['valign'] ) ) {
-                       $imgAttribs['style'] = "vertical-align: {$fp['valign']}";
-               }
-               if ( isset( $fp['border'] ) ) {
-                       $imgAttribs['class'] = "thumbborder";
-               }
-               $linkAttribs = array(
-                       'href' => $url,
-                       'class' => 'image',
-                       'title' => $fp['alt']
-               );
-
                if ( !$thumb ) {
                        $s = $this->makeBrokenImageLinkObj( $title );
                } else {
-                       $s = $thumb->toHtml( $imgAttribs, $linkAttribs );
+                       $s = $thumb->toHtml( array(
+                               'desc-link' => true,
+                               'alt' => $fp['alt'],
+                               'valign' => isset( $fp['valign'] ) ? $fp['valign'] : false ) );
                }
                if ( '' != $fp['align'] ) {
                        $s = "<div class=\"float{$fp['align']}\"><span>{$s}</span></div>";
@@ -684,18 +664,10 @@ class Linker {
                        $s .= htmlspecialchars( wfMsg( 'thumbnail_error', '' ) );
                        $zoomicon = '';
                } else {
-                       $imgAttribs = array(
+                       $s .= $thumb->toHtml( array(
                                'alt' => $fp['alt'],
-                               'longdesc' => $url,
-                               'class' => 'thumbimage'
-                       );
-                       $linkAttribs = array(
-                               'href' => $url,
-                               'class' => 'internal',
-                               'title' => $fp['alt']
-                       );
-                       
-                       $s .= $thumb->toHtml( $imgAttribs, $linkAttribs );
+                               'img-class' => 'thumbimage',
+                               'desc-link' => true ) );
                        if ( isset( $fp['framed'] ) ) {
                                $zoomicon="";
                        } else {
index 8745bb5..c6cf9ac 100644 (file)
@@ -6,6 +6,8 @@
  * @addtogroup Media
  */
 abstract class MediaTransformOutput {
+       var $file, $width, $height, $url, $page, $path;
+
        /**
         * Get the width of the output box
         */
@@ -36,12 +38,23 @@ abstract class MediaTransformOutput {
 
        /**
         * Fetch HTML for this transform output
-        * @param array $attribs Advisory associative array of HTML attributes supplied 
-        *    by the linker. These can be incorporated into the output in any way.
-        * @param array $linkAttribs Attributes of a suggested enclosing <a> tag. 
-        *    May be ignored.
+        *
+        * @param array $options Associative array of options. Boolean options 
+        *     should be indicated with a value of true for true, and false or 
+        *     absent for false.
+        *
+        *     alt          Alternate text or caption
+        *     desc-link    Boolean, show a description link
+        *     file-link    Boolean, show a file download link
+        *     valign       vertical-align property, if the output is an inline element
+        *     img-class    Class applied to the <img> tag, if there is such a tag
+        *
+        * For images, desc-link and file-link are implemented as a click-through. For 
+        * sounds and videos, they may be displayed in other ways. 
+        *
+        * @return string
         */
-       abstract function toHtml( $attribs = array() , $linkAttribs = false );
+       abstract function toHtml( $options = array() );
 
        /**
         * This will be overridden to return true in error classes
@@ -60,6 +73,19 @@ abstract class MediaTransformOutput {
                        return $contents;
                }
        }
+
+       function getDescLinkAttribs( $alt = false ) {
+               $query = $this->page ? ( 'page=' . urlencode( $this->page ) ) : '';
+               $title = $this->file->getTitle();
+               if ( strval( $alt ) === '' ) {
+                       $alt = $title->getText();
+               }
+               return array( 
+                       'href' => $this->file->getTitle()->getLocalURL( $query ),
+                       'class' => 'image',
+                       'title' => $alt
+               );
+       }
 }
 
 
@@ -74,7 +100,8 @@ class ThumbnailImage extends MediaTransformOutput {
         * @param string $url URL path to the thumb
         * @private
         */
-       function ThumbnailImage( $url, $width, $height, $path = false ) {
+       function ThumbnailImage( $file, $url, $width, $height, $path = false, $page = false ) {
+               $this->file = $file;
                $this->url = $url;
                # These should be integers when they get here.
                # If not, there's a bug somewhere.  But let's at
@@ -82,28 +109,56 @@ class ThumbnailImage extends MediaTransformOutput {
                $this->width = round( $width );
                $this->height = round( $height );
                $this->path = $path;
+               $this->page = $page;
        }
 
        /**
         * Return HTML <img ... /> tag for the thumbnail, will include
         * width and height attributes and a blank alt text (as required).
+        * 
+        * @param array $options Associative array of options. Boolean options 
+        *     should be indicated with a value of true for true, and false or 
+        *     absent for false.
         *
-        * You can set or override additional attributes by passing an
-        * associative array of name => data pairs. The data will be escaped
-        * for HTML output, so should be in plaintext.
+        *     alt          Alternate text or caption
+        *     desc-link    Boolean, show a description link
+        *     file-link    Boolean, show a file download link
+        *     valign       vertical-align property, if the output is an inline element
+        *     img-class    Class applied to the <img> tag, if there is such a tag
         *
-        * If $linkAttribs is given, the image will be enclosed in an <a> tag.
+        * For images, desc-link and file-link are implemented as a click-through. For 
+        * sounds and videos, they may be displayed in other ways. 
         *
-        * @param array $attribs
-        * @param array $linkAttribs
         * @return string
         * @public
         */
-       function toHtml( $attribs = array(), $linkAttribs = false ) {
-               $attribs['src'] = $this->url;
-               $attribs['width'] = $this->width;
-               $attribs['height'] = $this->height;
-               if( !isset( $attribs['alt'] ) ) $attribs['alt'] = '';
+       function toHtml( $options = array() ) {
+               if ( count( func_get_args() ) == 2 ) {
+                       throw new MWException( __METHOD__ .' called in the old style' );
+               }
+
+               $alt = empty( $options['alt'] ) ? '' : $options['alt'];
+               if ( !empty( $options['desc-link'] ) ) {
+                       $linkAttribs = $this->getDescLinkAttribs( $alt );
+               } elseif ( !empty( $options['file-link'] ) ) {
+                       $linkAttribs = array( 'href' => $this->file->getURL() );
+               } else {
+                       $linkAttribs = false;
+               }
+
+               $attribs = array(
+                       'alt' => $alt,
+                       'src' => $this->url,
+                       'width' => $this->width,
+                       'height' => $this->height,
+                       'border' => 0,
+               );
+               if ( !empty( $options['valign'] ) ) {
+                       $attribs['style'] = "vertical-align: {$options['valign']}";
+               }
+               if ( !empty( $options['img-class'] ) ) {
+                       $attribs['class'] = $options['img-class'];
+               }
                return $this->linkWrap( $linkAttribs, Xml::element( 'img', $attribs ) );
        }
 
@@ -130,7 +185,7 @@ class MediaTransformError extends MediaTransformOutput {
                $this->path = false;
        }
 
-       function toHtml( $attribs = array(), $linkAttribs = false ) {
+       function toHtml( $options = array() ) {
                return "<table class=\"MediaTransformError\" style=\"" .
                        "width: {$this->width}px; height: {$this->height}px;\"><tr><td>" .
                        $this->htmlMsg .
index ee55e25..a254a1d 100644 (file)
@@ -481,8 +481,8 @@ class UploadForm {
                                        $file->getName(), 'right', array(), false, true );
                        } elseif ( !$file->allowInlineDisplay() && $file->isSafeFile() ) {
                                $icon = $file->iconThumb();
-                               $dlink2 = '<div style="float:right" id="mw-media-icon"><a href="' . $file->getURL() . '">' . 
-                                       $icon->toHtml() . '</a><br />' . $dlink . '</div>';
+                               $dlink2 = '<div style="float:right" id="mw-media-icon">' . 
+                                       $icon->toHtml( array( 'desc-link' => true ) ) . '<br />' . $dlink . '</div>';
                        } else {
                                $dlink2 = '';
                        }
@@ -498,8 +498,8 @@ class UploadForm {
                                        $nt_lc->getText(), 'right', array(), false, true );
                        } elseif ( !$file_lc->allowInlineDisplay() && $file_lc->isSafeFile() ) {
                                $icon = $file_lc->iconThumb();
-                               $dlink2 = '<div style="float:right" id="mw-media-icon"><a href="' . $file_lc->getURL() . '">' . 
-                                       $icon->toHtml() . '</a><br />' . $dlink . '</div>';
+                               $dlink2 = '<div style="float:right" id="mw-media-icon">' . 
+                                       $icon->toHtml( array( 'desc-link' => true ) ) . '<br />' . $dlink . '</div>';
                        } else {
                                $dlink2 = '';
                        }
@@ -522,8 +522,8 @@ class UploadForm {
                                                $nt_thb->getText(), 'right', array(), false, true );
                                } elseif ( !$file_thb->allowInlineDisplay() && $file_thb->isSafeFile() ) {
                                        $icon = $file_thb->iconThumb();
-                                       $dlink2 = '<div style="float:right" id="mw-media-icon"><a href="' . 
-                                               $file_thb->getURL() . '">' . $icon->toHtml() . '</a><br />' . 
+                                       $dlink2 = '<div style="float:right" id="mw-media-icon">' . 
+                                               $icon->toHtml( array( 'desc-link' => true ) ) . '<br />' . 
                                                $dlink . '</div>';
                                } else {
                                        $dlink2 = '';
index 84b64fb..21b7a86 100644 (file)
@@ -559,7 +559,7 @@ abstract class File {
                        $path = '/common/images/icons/' . $icon;
                        $filepath = $wgStyleDirectory . $path;
                        if( file_exists( $filepath ) ) {
-                               return new ThumbnailImage( $wgStylePath . $path, 120, 120 );
+                               return new ThumbnailImage( $this, $wgStylePath . $path, 120, 120 );
                        }
                }
                return null;
index 245abb8..ca82aab 100644 (file)
@@ -58,7 +58,7 @@ class BitmapHandler extends ImageHandler {
                if ( $physicalWidth == $srcWidth && $physicalHeight == $srcHeight ) {
                        # normaliseParams (or the user) wants us to return the unscaled image
                        wfDebug( __METHOD__.": returning unscaled image\n" );
-                       return new ThumbnailImage( $image->getURL(), $clientWidth, $clientHeight, $srcPath );
+                       return new ThumbnailImage( $image, $image->getURL(), $clientWidth, $clientHeight, $srcPath );
                }
 
                if ( !$dstPath ) {
@@ -77,11 +77,11 @@ class BitmapHandler extends ImageHandler {
                if ( $scaler == 'client' ) {
                        # Client-side image scaling, use the source URL
                        # Using the destination URL in a TRANSFORM_LATER request would be incorrect
-                       return new ThumbnailImage( $image->getURL(), $clientWidth, $clientHeight, $srcPath );
+                       return new ThumbnailImage( $image, $image->getURL(), $clientWidth, $clientHeight, $srcPath );
                }
 
                if ( $flags & self::TRANSFORM_LATER ) {
-                       return new ThumbnailImage( $dstUrl, $clientWidth, $clientHeight, $dstPath );
+                       return new ThumbnailImage( $image, $dstUrl, $clientWidth, $clientHeight, $dstPath );
                }
 
                if ( !wfMkdirParents( dirname( $dstPath ) ) ) {
@@ -201,7 +201,7 @@ class BitmapHandler extends ImageHandler {
                                        wfHostname(), $retval, trim($err), $cmd ) );
                        return new MediaTransformError( 'thumbnail_error', $clientWidth, $clientHeight, $err );
                } else {
-                       return new ThumbnailImage( $dstUrl, $clientWidth, $clientHeight, $dstPath );
+                       return new ThumbnailImage( $image, $dstUrl, $clientWidth, $clientHeight, $dstPath );
                }
        }
 
index 45664db..20e59d1 100644 (file)
@@ -83,7 +83,7 @@ class DjVuHandler extends ImageHandler {
                }
                
                if ( $flags & self::TRANSFORM_LATER ) {
-                       return new ThumbnailImage( $dstUrl, $width, $height, $dstPath );
+                       return new ThumbnailImage( $image, $dstUrl, $width, $height, $dstPath, $page );
                }
 
                if ( !wfMkdirParents( dirname( $dstPath ) ) ) {
@@ -110,7 +110,7 @@ class DjVuHandler extends ImageHandler {
                                        wfHostname(), $retval, trim($err), $cmd ) );
                        return new MediaTransformError( 'thumbnail_error', $width, $height, $err );
                } else {
-                       return new ThumbnailImage( $dstUrl, $width, $height, $dstPath );
+                       return new ThumbnailImage( $image, $dstUrl, $width, $height, $dstPath, $page );
                }
        }
 
index 12c3051..a0707c2 100644 (file)
@@ -349,7 +349,8 @@ abstract class ImageHandler extends MediaHandler {
                        return false;
                }
                $url = $script . '&' . wfArrayToCGI( $this->getScriptParams( $params ) );
-               return new ThumbnailImage( $url, $params['width'], $params['height'] );
+               $page = isset( $params['page'] ) ? $params['page'] : false;
+               return new ThumbnailImage( $image, $url, $params['width'], $params['height'], $page );
        }
 
        /**
index d279a1a..75d0ad3 100644 (file)
@@ -49,7 +49,7 @@ class SvgHandler extends ImageHandler {
                $srcPath = $image->getPath();
 
                if ( $flags & self::TRANSFORM_LATER ) {
-                       return new ThumbnailImage( $dstUrl, $clientWidth, $clientHeight, $dstPath );
+                       return new ThumbnailImage( $image, $dstUrl, $clientWidth, $clientHeight, $dstPath );
                }
 
                if ( !wfMkdirParents( dirname( $dstPath ) ) ) {
@@ -80,7 +80,7 @@ class SvgHandler extends ImageHandler {
                                        wfHostname(), $retval, trim($err), $cmd ) );
                        return new MediaTransformError( 'thumbnail_error', $clientWidth, $clientHeight, $err );
                } else {
-                       return new ThumbnailImage( $dstUrl, $clientWidth, $clientHeight, $dstPath );
+                       return new ThumbnailImage( $image, $dstUrl, $clientWidth, $clientHeight, $dstPath );
                }
        }
 
index cd3887f..27cc792 100644 (file)
@@ -2946,7 +2946,7 @@ Simple image
 !! input
 [[Image:foobar.jpg]]
 !! result
-<p><a href="/wiki/Image:Foobar.jpg" class="image" title="Image:foobar.jpg"><img alt="Image:foobar.jpg" longdesc="/wiki/Image:Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
+<p><a href="/wiki/Image:Foobar.jpg" class="image" title="Image:foobar.jpg"><img alt="Image:foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" border="0" /></a>
 </p>
 !! end
 
@@ -2955,7 +2955,7 @@ Right-aligned image
 !! input
 [[Image:foobar.jpg|right]]
 !! result
-<div class="floatright"><span><a href="/wiki/Image:Foobar.jpg" class="image" title=""><img alt="" longdesc="/wiki/Image:Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a></span></div>
+<div class="floatright"><span><a href="/wiki/Image:Foobar.jpg" class="image" title="Foobar.jpg"><img alt="" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" border="0" /></a></span></div>
 
 !! end
 
@@ -2964,7 +2964,7 @@ Image with caption
 !! input
 [[Image:foobar.jpg|right|Caption text]]
 !! result
-<div class="floatright"><span><a href="/wiki/Image:Foobar.jpg" class="image" title="Caption text"><img alt="Caption text" longdesc="/wiki/Image:Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a></span></div>
+<div class="floatright"><span><a href="/wiki/Image:Foobar.jpg" class="image" title="Caption text"><img alt="Caption text" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" border="0" /></a></span></div>
 
 !! end
 
@@ -2973,7 +2973,7 @@ Image with frame and link
 !! input
 [[Image:Foobar.jpg|frame|left|This is a test image [[Main Page]]]]
 !! result
-<div class="thumb tleft"><div class="thumbinner" style="width:1943px;"><a href="/wiki/Image:Foobar.jpg" class="internal" title="This is a test image Main Page"><img alt="This is a test image Main Page" longdesc="/wiki/Image:Foobar.jpg" class="thumbimage" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>  <div class="thumbcaption">This is a test image <a href="/wiki/Main_Page" title="Main Page">Main Page</a></div></div></div>
+<div class="thumb tleft"><div class="thumbinner" style="width:1943px;"><a href="/wiki/Image:Foobar.jpg" class="image" title="This is a test image Main Page"><img alt="This is a test image Main Page" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" border="0" class="thumbimage" /></a>  <div class="thumbcaption">This is a test image <a href="/wiki/Main_Page" title="Main Page">Main Page</a></div></div></div>
 
 !! end
 
@@ -2993,7 +2993,7 @@ Frameless image caption with a free URL
 !! input
 [[Image:foobar.jpg|http://example.com]]
 !! result
-<p><a href="/wiki/Image:Foobar.jpg" class="image" title="http://example.com"><img alt="http://example.com" longdesc="/wiki/Image:Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
+<p><a href="/wiki/Image:Foobar.jpg" class="image" title="http://example.com"><img alt="http://example.com" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" border="0" /></a>
 </p>
 !! end
 
@@ -3002,7 +3002,7 @@ Thumbnail image caption with a free URL
 !! input
 [[Image:foobar.jpg|thumb|http://example.com]]
 !! result
-<div class="thumb tright"><div class="thumbinner" style="width:182px;"><a href="/wiki/Image:Foobar.jpg" class="internal" title="http://example.com"><img alt="http://example.com" longdesc="/wiki/Image:Foobar.jpg" class="thumbimage" src="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg" width="180" height="20" /></a>  <div class="thumbcaption"><div class="magnify" style="float:right"><a href="/wiki/Image:Foobar.jpg" class="internal" title="Enlarge"><img src="/skins/common/images/magnify-clip.png" width="15" height="11" alt="" /></a></div><a href="http://example.com" class="external free" title="http://example.com" rel="nofollow">http://example.com</a></div></div></div>
+<div class="thumb tright"><div class="thumbinner" style="width:182px;"><a href="/wiki/Image:Foobar.jpg" class="image" title="http://example.com"><img alt="http://example.com" src="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg" width="180" height="20" border="0" class="thumbimage" /></a>  <div class="thumbcaption"><div class="magnify" style="float:right"><a href="/wiki/Image:Foobar.jpg" class="internal" title="Enlarge"><img src="/skins/common/images/magnify-clip.png" width="15" height="11" alt="" /></a></div><a href="http://example.com" class="external free" title="http://example.com" rel="nofollow">http://example.com</a></div></div></div>
 
 !! end
 
@@ -3011,7 +3011,7 @@ BUG 1887: A ISBN with a thumbnail
 !! input
 [[Image:foobar.jpg|thumb|ISBN 1235467890]]
 !! result
-<div class="thumb tright"><div class="thumbinner" style="width:182px;"><a href="/wiki/Image:Foobar.jpg" class="internal" title="ISBN 1235467890"><img alt="ISBN 1235467890" longdesc="/wiki/Image:Foobar.jpg" class="thumbimage" src="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg" width="180" height="20" /></a>  <div class="thumbcaption"><div class="magnify" style="float:right"><a href="/wiki/Image:Foobar.jpg" class="internal" title="Enlarge"><img src="/skins/common/images/magnify-clip.png" width="15" height="11" alt="" /></a></div><a href="/index.php?title=Special:Booksources&amp;isbn=1235467890" class="internal">ISBN 1235467890</a></div></div></div>
+<div class="thumb tright"><div class="thumbinner" style="width:182px;"><a href="/wiki/Image:Foobar.jpg" class="image" title="ISBN 1235467890"><img alt="ISBN 1235467890" src="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg" width="180" height="20" border="0" class="thumbimage" /></a>  <div class="thumbcaption"><div class="magnify" style="float:right"><a href="/wiki/Image:Foobar.jpg" class="internal" title="Enlarge"><img src="/skins/common/images/magnify-clip.png" width="15" height="11" alt="" /></a></div><a href="/index.php?title=Special:Booksources&amp;isbn=1235467890" class="internal">ISBN 1235467890</a></div></div></div>
 
 !! end
 
@@ -3020,7 +3020,7 @@ BUG 1887: A RFC with a thumbnail
 !! input
 [[Image:foobar.jpg|thumb|This is RFC 12354]]
 !! result
-<div class="thumb tright"><div class="thumbinner" style="width:182px;"><a href="/wiki/Image:Foobar.jpg" class="internal" title="This is RFC 12354"><img alt="This is RFC 12354" longdesc="/wiki/Image:Foobar.jpg" class="thumbimage" src="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg" width="180" height="20" /></a>  <div class="thumbcaption"><div class="magnify" style="float:right"><a href="/wiki/Image:Foobar.jpg" class="internal" title="Enlarge"><img src="/skins/common/images/magnify-clip.png" width="15" height="11" alt="" /></a></div>This is <a href="http://tools.ietf.org/html/rfc12354" class="external" title="http://tools.ietf.org/html/rfc12354">RFC 12354</a></div></div></div>
+<div class="thumb tright"><div class="thumbinner" style="width:182px;"><a href="/wiki/Image:Foobar.jpg" class="image" title="This is RFC 12354"><img alt="This is RFC 12354" src="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg" width="180" height="20" border="0" class="thumbimage" /></a>  <div class="thumbcaption"><div class="magnify" style="float:right"><a href="/wiki/Image:Foobar.jpg" class="internal" title="Enlarge"><img src="/skins/common/images/magnify-clip.png" width="15" height="11" alt="" /></a></div>This is <a href="http://tools.ietf.org/html/rfc12354" class="external" title="http://tools.ietf.org/html/rfc12354">RFC 12354</a></div></div></div>
 
 !! end
 
@@ -3029,7 +3029,7 @@ BUG 1887: A mailto link with a thumbnail
 !! input
 [[Image:foobar.jpg|thumb|Please mailto:nobody@example.com]]
 !! result
-<div class="thumb tright"><div class="thumbinner" style="width:182px;"><a href="/wiki/Image:Foobar.jpg" class="internal" title="Please mailto:nobody@example.com"><img alt="Please mailto:nobody@example.com" longdesc="/wiki/Image:Foobar.jpg" class="thumbimage" src="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg" width="180" height="20" /></a>  <div class="thumbcaption"><div class="magnify" style="float:right"><a href="/wiki/Image:Foobar.jpg" class="internal" title="Enlarge"><img src="/skins/common/images/magnify-clip.png" width="15" height="11" alt="" /></a></div>Please <a href="mailto:nobody@example.com" class="external free" title="mailto:nobody@example.com" rel="nofollow">mailto:nobody@example.com</a></div></div></div>
+<div class="thumb tright"><div class="thumbinner" style="width:182px;"><a href="/wiki/Image:Foobar.jpg" class="image" title="Please mailto:nobody@example.com"><img alt="Please mailto:nobody@example.com" src="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg" width="180" height="20" border="0" class="thumbimage" /></a>  <div class="thumbcaption"><div class="magnify" style="float:right"><a href="/wiki/Image:Foobar.jpg" class="internal" title="Enlarge"><img src="/skins/common/images/magnify-clip.png" width="15" height="11" alt="" /></a></div>Please <a href="mailto:nobody@example.com" class="external free" title="mailto:nobody@example.com" rel="nofollow">mailto:nobody@example.com</a></div></div></div>
 
 !! end
 
@@ -3039,7 +3039,7 @@ so math is not stripped and turns up as escaped &lt;math&gt; tags.
 !! input
 [[Image:foobar.jpg|thumb|<math>2+2</math>]]
 !! result
-<div class="thumb tright"><div class="thumbinner" style="width:182px;"><a href="/wiki/Image:Foobar.jpg" class="internal" title="&lt;math&gt;2+2&lt;/math&gt;"><img alt="&lt;math&gt;2+2&lt;/math&gt;" longdesc="/wiki/Image:Foobar.jpg" class="thumbimage" src="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg" width="180" height="20" /></a>  <div class="thumbcaption"><div class="magnify" style="float:right"><a href="/wiki/Image:Foobar.jpg" class="internal" title="Enlarge"><img src="/skins/common/images/magnify-clip.png" width="15" height="11" alt="" /></a></div>&lt;math&gt;2+2&lt;/math&gt;</div></div></div>
+<div class="thumb tright"><div class="thumbinner" style="width:182px;"><a href="/wiki/Image:Foobar.jpg" class="image" title="&lt;math&gt;2+2&lt;/math&gt;"><img alt="&lt;math&gt;2+2&lt;/math&gt;" src="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg" width="180" height="20" border="0" class="thumbimage" /></a>  <div class="thumbcaption"><div class="magnify" style="float:right"><a href="/wiki/Image:Foobar.jpg" class="internal" title="Enlarge"><img src="/skins/common/images/magnify-clip.png" width="15" height="11" alt="" /></a></div>&lt;math&gt;2+2&lt;/math&gt;</div></div></div>
 
 !! end
 
@@ -3050,7 +3050,7 @@ math
 !! input
 [[Image:foobar.jpg|thumb|<math>2+2</math>]]
 !! result
-<div class="thumb tright"><div class="thumbinner" style="width:182px;"><a href="/wiki/Image:Foobar.jpg" class="internal" title="2 + 2"><img alt="2 + 2" longdesc="/wiki/Image:Foobar.jpg" class="thumbimage" src="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg" width="180" height="20" /></a>  <div class="thumbcaption"><div class="magnify" style="float:right"><a href="/wiki/Image:Foobar.jpg" class="internal" title="Enlarge"><img src="/skins/common/images/magnify-clip.png" width="15" height="11" alt="" /></a></div><span class="texhtml">2 + 2</span></div></div></div>
+<div class="thumb tright"><div class="thumbinner" style="width:182px;"><a href="/wiki/Image:Foobar.jpg" class="image" title="2 + 2"><img alt="2 + 2" src="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg" width="180" height="20" border="0" class="thumbimage" /></a>  <div class="thumbcaption"><div class="magnify" style="float:right"><a href="/wiki/Image:Foobar.jpg" class="internal" title="Enlarge"><img src="/skins/common/images/magnify-clip.png" width="15" height="11" alt="" /></a></div><span class="texhtml">2 + 2</span></div></div></div>
 
 !! end
 
@@ -3060,7 +3060,7 @@ BUG 648: Frameless image caption with a link
 !! input
 [[Image:foobar.jpg|text with a [[link]] in it]]
 !! result
-<p><a href="/wiki/Image:Foobar.jpg" class="image" title="text with a link in it"><img alt="text with a link in it" longdesc="/wiki/Image:Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
+<p><a href="/wiki/Image:Foobar.jpg" class="image" title="text with a link in it"><img alt="text with a link in it" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" border="0" /></a>
 </p>
 !! end
 
@@ -3069,7 +3069,7 @@ BUG 648: Frameless image caption with a link (suffix)
 !! input
 [[Image:foobar.jpg|text with a [[link]]foo in it]]
 !! result
-<p><a href="/wiki/Image:Foobar.jpg" class="image" title="text with a linkfoo in it"><img alt="text with a linkfoo in it" longdesc="/wiki/Image:Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
+<p><a href="/wiki/Image:Foobar.jpg" class="image" title="text with a linkfoo in it"><img alt="text with a linkfoo in it" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" border="0" /></a>
 </p>
 !! end
 
@@ -3078,7 +3078,7 @@ BUG 648: Frameless image caption with an interwiki link
 !! input
 [[Image:foobar.jpg|text with a [[MeatBall:Link]] in it]]
 !! result
-<p><a href="/wiki/Image:Foobar.jpg" class="image" title="text with a MeatBall:Link in it"><img alt="text with a MeatBall:Link in it" longdesc="/wiki/Image:Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
+<p><a href="/wiki/Image:Foobar.jpg" class="image" title="text with a MeatBall:Link in it"><img alt="text with a MeatBall:Link in it" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" border="0" /></a>
 </p>
 !! end
 
@@ -3087,7 +3087,7 @@ BUG 648: Frameless image caption with a piped interwiki link
 !! input
 [[Image:foobar.jpg|text with a [[MeatBall:Link|link]] in it]]
 !! result
-<p><a href="/wiki/Image:Foobar.jpg" class="image" title="text with a link in it"><img alt="text with a link in it" longdesc="/wiki/Image:Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
+<p><a href="/wiki/Image:Foobar.jpg" class="image" title="text with a link in it"><img alt="text with a link in it" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" border="0" /></a>
 </p>
 !! end
 
@@ -3096,7 +3096,7 @@ Escape HTML special chars in image alt text
 !! input
 [[Image:foobar.jpg|& < > "]]
 !! result
-<p><a href="/wiki/Image:Foobar.jpg" class="image" title="&amp; &lt; &gt; &quot;"><img alt="&amp; &lt; &gt; &quot;" longdesc="/wiki/Image:Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
+<p><a href="/wiki/Image:Foobar.jpg" class="image" title="&amp; &lt; &gt; &quot;"><img alt="&amp; &lt; &gt; &quot;" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" border="0" /></a>
 </p>
 !! end
 
@@ -3105,7 +3105,7 @@ BUG 499: Alt text should have &#1234;, not &amp;1234;
 !! input
 [[Image:foobar.jpg|&#9792;]]
 !! result
-<p><a href="/wiki/Image:Foobar.jpg" class="image" title="♀"><img alt="♀" longdesc="/wiki/Image:Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
+<p><a href="/wiki/Image:Foobar.jpg" class="image" title="♀"><img alt="♀" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" border="0" /></a>
 </p>
 !! end
 
@@ -3123,7 +3123,7 @@ Image caption containing another image
 !! input
 [[Image:Foobar.jpg|thumb|This is a caption with another [[Image:icon.png|image]] inside it!]]
 !! result
-<div class="thumb tright"><div class="thumbinner" style="width:182px;"><a href="/wiki/Image:Foobar.jpg" class="internal" title="This is a caption with another Image:Icon.png inside it!"><img alt="This is a caption with another Image:Icon.png inside it!" longdesc="/wiki/Image:Foobar.jpg" class="thumbimage" src="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg" width="180" height="20" /></a>  <div class="thumbcaption"><div class="magnify" style="float:right"><a href="/wiki/Image:Foobar.jpg" class="internal" title="Enlarge"><img src="/skins/common/images/magnify-clip.png" width="15" height="11" alt="" /></a></div>This is a caption with another <a href="/index.php?title=Special:Upload&amp;wpDestFile=Icon.png" class="new" title="Image:Icon.png">Image:Icon.png</a> inside it!</div></div></div>
+<div class="thumb tright"><div class="thumbinner" style="width:182px;"><a href="/wiki/Image:Foobar.jpg" class="image" title="This is a caption with another Image:Icon.png inside it!"><img alt="This is a caption with another Image:Icon.png inside it!" src="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg" width="180" height="20" border="0" class="thumbimage" /></a>  <div class="thumbcaption"><div class="magnify" style="float:right"><a href="/wiki/Image:Foobar.jpg" class="internal" title="Enlarge"><img src="/skins/common/images/magnify-clip.png" width="15" height="11" alt="" /></a></div>This is a caption with another <a href="/index.php?title=Special:Upload&amp;wpDestFile=Icon.png" class="new" title="Image:Icon.png">Image:Icon.png</a> inside it!</div></div></div>
 
 !! end
 
@@ -3133,7 +3133,7 @@ Image caption containing a newline
 [[Image:Foobar.jpg|This
 *is some text]]
 !! result
-<p><a href="/wiki/Image:Foobar.jpg" class="image" title="This *is some text"><img alt="This *is some text" longdesc="/wiki/Image:Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
+<p><a href="/wiki/Image:Foobar.jpg" class="image" title="This *is some text"><img alt="This *is some text" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" border="0" /></a>
 </p>
 !!end
 
@@ -3143,7 +3143,7 @@ Bug 3090: External links other than http: in image captions
 !! input
 [[Image:Foobar.jpg|thumb|200px|This caption has [irc://example.net irc] and [https://example.com Secure] ext links in it.]]
 !! result
-<div class="thumb tright"><div class="thumbinner" style="width:202px;"><a href="/wiki/Image:Foobar.jpg" class="internal" title="This caption has irc and Secure ext links in it."><img alt="This caption has irc and Secure ext links in it." longdesc="/wiki/Image:Foobar.jpg" class="thumbimage" src="http://example.com/images/thumb/3/3a/Foobar.jpg/200px-Foobar.jpg" width="200" height="23" /></a>  <div class="thumbcaption"><div class="magnify" style="float:right"><a href="/wiki/Image:Foobar.jpg" class="internal" title="Enlarge"><img src="/skins/common/images/magnify-clip.png" width="15" height="11" alt="" /></a></div>This caption has <a href="irc://example.net" class="external text" title="irc://example.net" rel="nofollow">irc</a> and <a href="https://example.com" class="external text" title="https://example.com" rel="nofollow">Secure</a> ext links in it.</div></div></div>
+<div class="thumb tright"><div class="thumbinner" style="width:202px;"><a href="/wiki/Image:Foobar.jpg" class="image" title="This caption has irc and Secure ext links in it."><img alt="This caption has irc and Secure ext links in it." src="http://example.com/images/thumb/3/3a/Foobar.jpg/200px-Foobar.jpg" width="200" height="23" border="0" class="thumbimage" /></a>  <div class="thumbcaption"><div class="magnify" style="float:right"><a href="/wiki/Image:Foobar.jpg" class="internal" title="Enlarge"><img src="/skins/common/images/magnify-clip.png" width="15" height="11" alt="" /></a></div>This caption has <a href="irc://example.net" class="external text" title="irc://example.net" rel="nofollow">irc</a> and <a href="https://example.com" class="external text" title="https://example.com" rel="nofollow">Secure</a> ext links in it.</div></div></div>
 
 !! end
 
@@ -3503,7 +3503,7 @@ BUG 1219 URL next to image (good)
 !! input
 http://example.com [[Image:foobar.jpg]]
 !! result
-<p><a href="http://example.com" class="external free" title="http://example.com" rel="nofollow">http://example.com</a> <a href="/wiki/Image:Foobar.jpg" class="image" title="Image:foobar.jpg"><img alt="Image:foobar.jpg" longdesc="/wiki/Image:Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
+<p><a href="http://example.com" class="external free" title="http://example.com" rel="nofollow">http://example.com</a> <a href="/wiki/Image:Foobar.jpg" class="image" title="Image:foobar.jpg"><img alt="Image:foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" border="0" /></a>
 </p>
 !!end
 
@@ -3512,7 +3512,7 @@ BUG 1219 URL next to image (broken)
 !! input
 http://example.com[[Image:foobar.jpg]]
 !! result
-<p><a href="http://example.com" class="external free" title="http://example.com" rel="nofollow">http://example.com</a><a href="/wiki/Image:Foobar.jpg" class="image" title="Image:foobar.jpg"><img alt="Image:foobar.jpg" longdesc="/wiki/Image:Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
+<p><a href="http://example.com" class="external free" title="http://example.com" rel="nofollow">http://example.com</a><a href="/wiki/Image:Foobar.jpg" class="image" title="Image:foobar.jpg"><img alt="Image:foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" border="0" /></a>
 </p>
 !!end
 
@@ -4787,7 +4787,7 @@ Fuzz testing: image with bogus manual thumbnail
 !!input
 [[Image:foobar.jpg|thumbnail= ]]
 !!result
-<div class="thumb tright"><div class="thumbinner" style="width:182px;"><a href="/wiki/Image:Foobar.jpg" class="internal" title=""><img alt="" longdesc="/wiki/Image:Foobar.jpg" class="thumbimage" src="http://example.com/images/3/3a/Foobar.jpg" width="180" height="20" /></a>  <div class="thumbcaption"><div class="magnify" style="float:right"><a href="/wiki/Image:Foobar.jpg" class="internal" title="Enlarge"><img src="/skins/common/images/magnify-clip.png" width="15" height="11" alt="" /></a></div></div></div></div>
+<div class="thumb tright"><div class="thumbinner" style="width:1943px;">Error creating thumbnail:   <div class="thumbcaption"></div></div></div>
 
 !!end
 
@@ -6080,7 +6080,7 @@ Centre-aligned image
 !! input
 [[Image:foobar.jpg|centre]]
 !! result
-<div class="center"><div class="floatnone"><span><a href="/wiki/Image:Foobar.jpg" class="image" title=""><img alt="" longdesc="/wiki/Image:Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a></span></div></div>
+<div class="center"><div class="floatnone"><span><a href="/wiki/Image:Foobar.jpg" class="image" title="Foobar.jpg"><img alt="" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" border="0" /></a></span></div></div>
 
 !!end
 
@@ -6089,7 +6089,7 @@ None-aligned image
 !! input
 [[Image:foobar.jpg|none]]
 !! result
-<div class="floatnone"><span><a href="/wiki/Image:Foobar.jpg" class="image" title=""><img alt="" longdesc="/wiki/Image:Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a></span></div>
+<div class="floatnone"><span><a href="/wiki/Image:Foobar.jpg" class="image" title="Foobar.jpg"><img alt="" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" border="0" /></a></span></div>
 
 !!end
 
@@ -6098,7 +6098,7 @@ Width + Height sized image (using px) (height is ignored)
 !! input
 [[Image:foobar.jpg|640x480px]]
 !! result
-<p><a href="/wiki/Image:Foobar.jpg" class="image" title=""><img alt="" longdesc="/wiki/Image:Foobar.jpg" src="http://example.com/images/thumb/3/3a/Foobar.jpg/640px-Foobar.jpg" width="640" height="73" /></a>
+<p><a href="/wiki/Image:Foobar.jpg" class="image" title="Foobar.jpg"><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/640px-Foobar.jpg" width="640" height="73" border="0" /></a>
 </p>
 !!end
 
@@ -6136,7 +6136,7 @@ Images with the "|" character in the comment
 !! input
 [[image:Foobar.jpg|thumb|An [http://test/?param1=|left|&param2=|x external] URL]]
 !! result
-<div class="thumb tright"><div class="thumbinner" style="width:182px;"><a href="/wiki/Image:Foobar.jpg" class="internal" title="An external URL"><img alt="An external URL" longdesc="/wiki/Image:Foobar.jpg" class="thumbimage" src="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg" width="180" height="20" /></a>  <div class="thumbcaption"><div class="magnify" style="float:right"><a href="/wiki/Image:Foobar.jpg" class="internal" title="Enlarge"><img src="/skins/common/images/magnify-clip.png" width="15" height="11" alt="" /></a></div>An <a href="http://test/?param1=|left|&amp;param2=|x" class="external text" title="http://test/?param1=|left|&amp;param2=|x" rel="nofollow">external</a> URL</div></div></div>
+<div class="thumb tright"><div class="thumbinner" style="width:182px;"><a href="/wiki/Image:Foobar.jpg" class="image" title="An external URL"><img alt="An external URL" src="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg" width="180" height="20" border="0" class="thumbimage" /></a>  <div class="thumbcaption"><div class="magnify" style="float:right"><a href="/wiki/Image:Foobar.jpg" class="internal" title="Enlarge"><img src="/skins/common/images/magnify-clip.png" width="15" height="11" alt="" /></a></div>An <a href="http://test/?param1=|left|&amp;param2=|x" class="external text" title="http://test/?param1=|left|&amp;param2=|x" rel="nofollow">external</a> URL</div></div></div>
 
 !!end