40 $version = intval( explode(
';', $version, 2 )[0] );
41 if ( $version < 1 || $version >= 2 ) {
47 if ( !is_array( $metadata ) ) {
50 if ( !isset( $metadata[
'MEDIAWIKI_EXIF_VERSION'] ) || $metadata[
'MEDIAWIKI_EXIF_VERSION'] != 2 ) {
56 if ( isset( $metadata[
'Software'] )
57 && is_array( $metadata[
'Software'] )
58 && is_array( $metadata[
'Software'][0] )
59 && isset( $metadata[
'Software'][0][0] )
60 && isset( $metadata[
'Software'][0][1] )
62 $metadata[
'Software'] = $metadata[
'Software'][0][0] .
' (Version '
63 . $metadata[
'Software'][0][1] .
')';
69 if ( isset( $metadata[
'Contact'] ) ) {
70 $metadata[
'Contact'] =
72 $metadata[
'Contact'] );
75 foreach ( $metadata as &$val ) {
76 if ( is_array( $val ) ) {
77 $val = $formatter->flattenArrayReal( $val,
'ul', $avoidHtml );
80 $metadata[
'MEDIAWIKI_EXIF_VERSION'] = 1;
93 # Metadata disabled and so an empty field is expected
96 if ( $metadata === self::OLD_BROKEN_FILE ) {
97 # Old special value indicating that there is no Exif data in the file.
98 # or that there was an error well extracting the metadata.
99 wfDebug( __METHOD__ .
": back-compat version" );
103 if ( $metadata === self::BROKEN_FILE ) {
106 Wikimedia\suppressWarnings();
108 Wikimedia\restoreWarnings();
109 if ( !isset( $exif[
'MEDIAWIKI_EXIF_VERSION'] )
112 if ( isset( $exif[
'MEDIAWIKI_EXIF_VERSION'] )
113 && $exif[
'MEDIAWIKI_EXIF_VERSION'] == 1
116 wfDebug( __METHOD__ .
": back-compat version" );
120 # Wrong (non-compatible) version
121 wfDebug( __METHOD__ .
": wrong version" );
136 if ( count( $meta ) === 0 ) {
144 $metadata =
$file->getMetadata();
145 if ( $metadata === self::OLD_BROKEN_FILE
146 || $metadata === self::BROKEN_FILE
158 unset( $exif[
'MEDIAWIKI_EXIF_VERSION'] );
176 $gis = parent::getImageSize( $image,
$path );
187 if ( $rotation == 90 || $rotation == 270 ) {
213 $data =
$file->getMetadata();
230 Wikimedia\suppressWarnings();
232 Wikimedia\restoreWarnings();
233 if ( isset( $data[
'Orientation'] ) ) {
235 switch ( $data[
'Orientation'] ) {
unserialize( $serialized)
$wgShowEXIF
Show Exif data, on by default if available.
wfDebug( $text, $dest='all', array $context=[])
Sends a line to the debug log if enabled or, optionally, to a comment in output.
Generic handler for bitmap images.
Stuff specific to JPEG and (built-in) TIFF handler.
getMetadataType( $image)
Get a string describing the type of metadata, for display purposes.
isMetadataValid( $image, $metadata)
getCommonMetaArray(File $file)
Get an array of standard (FormatMetadata type) metadata values.
const OLD_BROKEN_FILE
Outdated error extracting metadata.
convertMetadataVersion( $metadata, $version=1)
Convert metadata version.
getRotation( $file)
On supporting image formats, try to read out the low-level orientation of the file and return the ang...
getRotationForExif( $data)
Given a chunk of serialized Exif metadata, return the orientation as degrees of rotation.
getImageSize( $image, $path)
Wrapper for base classes ImageHandler::getImageSize() that checks for rotation reported from metadata...
const BROKEN_FILE
Error extracting metadata.
formatMetadata( $image, $context=false)
Implements some public methods and some protected utility functions which are required by multiple ch...
if(PHP_SAPI !='cli-server') if(!isset( $_SERVER['SCRIPT_FILENAME'])) $file
Item class for a filearchive table row.