if ( !wfMkdirParents( dirname( $dstPath ), null, __METHOD__ ) ) {
return new MediaTransformError( 'thumbnail_error', $clientWidth, $clientHeight,
- wfMsg( 'thumbnail_dest_directory' ) );
+ wfMessage( 'thumbnail_dest_directory' )->text() );
}
$srcPath = $image->getLocalRefPath();
}
/**
+ * Subtitle for the image. Different from the base
+ * class so it can be denoted that SVG's have
+ * a "nominal" resolution, and not a fixed one,
+ * as well as so animation can be denoted.
+ *
* @param $file File
* @return string
*/
function getLongDesc( $file ) {
global $wgLang;
- return wfMsgExt( 'svg-long-desc', 'parseinline',
- $wgLang->formatNum( $file->getWidth() ),
- $wgLang->formatNum( $file->getHeight() ),
- $wgLang->formatSize( $file->getSize() ) );
+ $size = $wgLang->formatSize( $file->getSize() );
+
+ if ( $this->isAnimatedImage( $file ) ) {
+ $msg = wfMessage( 'svg-long-desc-animated' );
+ } else {
+ $msg = wfMessage( 'svg-long-desc' );
+ }
+
+ $msg->numParams(
+ $file->getWidth(),
+ $file->getHeight()
+ );
+ $msg->Params( $size );
+ return $msg->parse();
}
function getMetadata( $file, $filename ) {
}
function visibleMetadataFields() {
- $fields = array( 'title', 'description', 'animated' );
+ $fields = array( 'objectname', 'imagedescription' );
return $fields;
}
if ( !$metadata ) {
return false;
}
- unset( $metadata['version'] );
- unset( $metadata['metadata'] ); /* non-formatted XML */
/* TODO: add a formatter
$format = new FormatSVG( $metadata );
$visibleFields = $this->visibleMetadataFields();
// Rename fields to be compatible with exif, so that
- // the labels for these fields work.
- $conversion = array( 'width' => 'imagewidth',
+ // the labels for these fields work and reuse existing messages.
+ $conversion = array(
+ 'width' => 'imagewidth',
'height' => 'imagelength',
'description' => 'imagedescription',
'title' => 'objectname',
$tag = strtolower( $name );
if ( isset( $conversion[$tag] ) ) {
$tag = $conversion[$tag];
+ } else {
+ // Do not output other metadata not in list
+ continue;
}
self::addMeta( $result,
in_array( $tag, $visibleFields ) ? 'visible' : 'collapsed',