36 $version = intval( explode(
';', $version, 2 )[0] );
37 if ( $version < 1 || $version >= 2 ) {
43 if ( !is_array( $metadata ) ) {
46 if ( !isset( $metadata[
'MEDIAWIKI_EXIF_VERSION'] ) || $metadata[
'MEDIAWIKI_EXIF_VERSION'] != 2 ) {
52 if ( isset( $metadata[
'Software'] )
53 && is_array( $metadata[
'Software'] )
54 && is_array( $metadata[
'Software'][0] )
55 && isset( $metadata[
'Software'][0][0] )
56 && isset( $metadata[
'Software'][0][1] )
58 $metadata[
'Software'] = $metadata[
'Software'][0][0] .
' (Version '
59 . $metadata[
'Software'][0][1] .
')';
65 if ( isset( $metadata[
'Contact'] ) ) {
66 $metadata[
'Contact'] =
68 $metadata[
'Contact'] );
71 foreach ( $metadata as &$val ) {
72 if ( is_array( $val ) ) {
73 $val = $formatter->flattenArrayReal( $val,
'ul', $avoidHtml );
76 $metadata[
'MEDIAWIKI_EXIF_VERSION'] = 1;
89 # Metadata disabled and so an empty field is expected
92 if ( $metadata === self::OLD_BROKEN_FILE ) {
93 # Old special value indicating that there is no Exif data in the file.
94 # or that there was an error well extracting the metadata.
95 wfDebug( __METHOD__ .
": back-compat version\n" );
99 if ( $metadata === self::BROKEN_FILE ) {
102 Wikimedia\suppressWarnings();
104 Wikimedia\restoreWarnings();
105 if ( !isset( $exif[
'MEDIAWIKI_EXIF_VERSION'] )
108 if ( isset( $exif[
'MEDIAWIKI_EXIF_VERSION'] )
109 && $exif[
'MEDIAWIKI_EXIF_VERSION'] == 1
112 wfDebug( __METHOD__ .
": back-compat version\n" );
116 # Wrong (non-compatible) version
117 wfDebug( __METHOD__ .
": wrong version\n" );
132 if ( count( $meta ) === 0 ) {
140 $metadata =
$file->getMetadata();
141 if ( $metadata === self::OLD_BROKEN_FILE
142 || $metadata === self::BROKEN_FILE
154 unset( $exif[
'MEDIAWIKI_EXIF_VERSION'] );
172 $gis = parent::getImageSize( $image,
$path );
183 if ( $rotation == 90 || $rotation == 270 ) {
209 $data =
$file->getMetadata();
226 Wikimedia\suppressWarnings();
228 Wikimedia\restoreWarnings();
229 if ( isset( $data[
'Orientation'] ) ) {
231 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.
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...
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.