Merge "Add no-dimensions option to MediaTransformOutput::toHtml"
authorjenkins-bot <jenkins-bot@gerrit.wikimedia.org>
Fri, 6 Dec 2013 21:44:45 +0000 (21:44 +0000)
committerGerrit Code Review <gerrit@wikimedia.org>
Fri, 6 Dec 2013 21:44:45 +0000 (21:44 +0000)
includes/media/MediaTransformOutput.php

index 81b285e..cfb163c 100644 (file)
@@ -318,6 +318,8 @@ class ThumbnailImage extends MediaTransformOutput {
         *     desc-query   String, description link query params
         *     override-width     Override width attribute. Should generally not set
         *     override-height    Override height attribute. Should generally not set
+        *     no-dimensions      Boolean, skip width and height attributes (useful if
+        *                        set in CSS)
         *     custom-url-link    Custom URL to link to
         *     custom-title-link  Custom Title object to link to
         *     custom target-link Value of the target attribute, for custom-target-link
@@ -373,9 +375,11 @@ class ThumbnailImage extends MediaTransformOutput {
                $attribs = array(
                        'alt' => $alt,
                        'src' => $this->url,
-                       'width' => $this->width,
-                       'height' => $this->height
                );
+               if ( empty( $options['no-dimensions'] ) ) {
+                       $attribs['width'] = $this->width;
+                       $attribs['height'] = $this->height;
+               }
                if ( !empty( $options['valign'] ) ) {
                        $attribs['style'] = "vertical-align: {$options['valign']}";
                }