40 $version = intval( explode(
';', $version, 2 )[0] );
41 if ( $version < 1 || $version >= 2 ) {
45 if ( !isset( $metadata[
'MEDIAWIKI_EXIF_VERSION'] ) || $metadata[
'MEDIAWIKI_EXIF_VERSION'] != 2 ) {
51 if ( isset( $metadata[
'Software'] )
52 && is_array( $metadata[
'Software'] )
53 && is_array( $metadata[
'Software'][0] )
54 && isset( $metadata[
'Software'][0][0] )
55 && isset( $metadata[
'Software'][0][1] )
57 $metadata[
'Software'] = $metadata[
'Software'][0][0] .
' (Version '
58 . $metadata[
'Software'][0][1] .
')';
64 if ( isset( $metadata[
'Contact'] ) ) {
66 is_array( $metadata[
'Contact'] ) ? $metadata[
'Contact'] : [ $metadata[
'Contact'] ]
70 foreach ( $metadata as &$val ) {
71 if ( is_array( $val ) ) {
73 $val = $formatter->flattenArrayReal( $val,
'ul',
true );
76 $metadata[
'MEDIAWIKI_EXIF_VERSION'] = 1;
88 # Metadata disabled and so an empty field is expected
91 $exif = $image->getMetadataArray();
93 wfDebug( __METHOD__ .
': error unserializing?' );
96 if ( $exif === [
'_error' => 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 ( $exif === [
'_error' => self::BROKEN_FILE ] ) {
107 if ( !isset( $exif[
'MEDIAWIKI_EXIF_VERSION'] )
110 if ( isset( $exif[
'MEDIAWIKI_EXIF_VERSION'] )
111 && $exif[
'MEDIAWIKI_EXIF_VERSION'] == 1
114 wfDebug( __METHOD__ .
": back-compat version" );
118 # Wrong (non-compatible) version
119 wfDebug( __METHOD__ .
": wrong version" );
142 $exif =
$file->getMetadataArray();
146 unset( $exif[
'MEDIAWIKI_EXIF_VERSION'] );
162 if ( $rotation == 90 || $rotation == 270 ) {
163 $width = $info[
'width'];
164 $info[
'width'] = $info[
'height'];
165 $info[
'height'] = $width;
187 $orientation =
$file->getMetadataItem(
'Orientation' );
200 if ( $orientation ===
null ) {
204 switch ( $orientation ) {
$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.
getRotationForExifFromOrientation( $orientation)
Given a chunk of serialized Exif metadata, return the orientation as degrees of rotation.
getMetadataType( $image)
Get a string describing the type of metadata, for display purposes.
getCommonMetaArray(File $file)
Get an array of standard (FormatMetadata type) metadata values.
applyExifRotation( $info, $metadata)
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...
isFileMetadataValid( $image)
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.