* (bug 23226) Add |class= parameter to image links in order to add class(es) to HTML img tag.
* (bug 39431) SVG animated status is now shown in long description
* (bug 39376) jquery.form upgraded to 3.14
+* SVG files will now show the actual width in the SVG's specified units
+ in the metadata box.
=== Bug fixes in 1.20 ===
* (bug 30245) Use the correct way to construct a log page title.
}
function isMetadataValid( $image, $metadata ) {
- return $this->unpackMetadata( $metadata ) !== false;
+ $meta = $this->unpackMetadata( $metadata );
+ if ( $meta === false ) {
+ return self::METADATA_BAD;
+ }
+ if ( !isset( $meta['originalWidth'] ) ) {
+ // Old but compatible
+ return self::METADATA_COMPATIBLE;
+ }
+ return self::METADATA_GOOD;
}
function visibleMetadataFields() {
// Rename fields to be compatible with exif, so that
// the labels for these fields work and reuse existing messages.
$conversion = array(
- 'width' => 'imagewidth',
- 'height' => 'imagelength',
+ 'originalwidth' => 'imagewidth',
+ 'originalheight' => 'imagelength',
'description' => 'imagedescription',
'title' => 'objectname',
);
$this->metadata['width'] = self::DEFAULT_WIDTH;
$this->metadata['height'] = self::DEFAULT_HEIGHT;
+ // The size in the units specified by the SVG file
+ // (for the metadata box)
+ // Per the SVG spec, if unspecified, default to '100%'
+ $this->metadata['originalWidth'] = '100%';
+ $this->metadata['originalHeight'] = '100%';
+
// Because we cut off the end of the svg making an invalid one. Complicated
// try catch thing to make sure warnings get restored. Seems like there should
// be a better way.
try {
$this->read();
} catch( Exception $e ) {
+ // Note, if this happens, the width/height will be taken to be 0x0.
+ // Should we consider it the default 512x512 instead?
wfRestoreWarnings();
throw $e;
}
}
if( $this->reader->getAttribute('width') ) {
$width = $this->scaleSVGUnit( $this->reader->getAttribute('width'), $defaultWidth );
+ $this->metadata['originalWidth'] = $this->reader->getAttribute( 'width' );
}
if( $this->reader->getAttribute('height') ) {
$height = $this->scaleSVGUnit( $this->reader->getAttribute('height'), $defaultHeight );
+ $this->metadata['originalHeight'] = $this->reader->getAttribute( 'height' );
}
if( !isset( $width ) && !isset( $height ) ) {
"$base/Wikimedia-logo.svg",
array(
'width' => 1024,
- 'height' => 1024
+ 'height' => 1024,
+ 'originalWidth' => '1024',
+ 'originalHeight' => '1024',
)
),
array(
"$base/QA_icon.svg",
array(
'width' => 60,
- 'height' => 60
+ 'height' => 60,
+ 'originalWidth' => '60',
+ 'originalHeight' => '60',
)
),
array(
"$base/Gtk-media-play-ltr.svg",
array(
'width' => 60,
- 'height' => 60
+ 'height' => 60,
+ 'originalWidth' => '60.0000000',
+ 'originalHeight' => '60.0000000',
)
),
array(
// This file triggered bug 31719, needs entity expansion in the xmlns checks
array(
'width' => 385,
- 'height' => 385
+ 'height' => 385,
+ 'originalWidth' => '385',
+ 'originalHeight' => '385.0004883',
)
)
);
array(
'height' => 593,
'metadata' => $metadata,
- 'width' => 959
+ 'width' => 959,
+ 'originalWidth' => '958.69',
+ 'originalHeight' => '592.78998',
)
),
);