From b23e03a9d6ab86afff4d96f8833f191ef9fbdd63 Mon Sep 17 00:00:00 2001 From: Juliusz Gonera Date: Fri, 18 Oct 2013 17:24:59 -0700 Subject: [PATCH] Add no-dimensions option to MediaTransformOutput::toHtml Skips width and height attributes (useful if set in CSS). Change-Id: Ib52182f1a56b71e381b1faa767ebad19ba92889c --- includes/media/MediaTransformOutput.php | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/includes/media/MediaTransformOutput.php b/includes/media/MediaTransformOutput.php index c49d3f2094..1ef10d2871 100644 --- a/includes/media/MediaTransformOutput.php +++ b/includes/media/MediaTransformOutput.php @@ -300,6 +300,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 @@ -352,9 +354,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']}"; } -- 2.20.1