* @see http://exif.org/Exif2-2.PDF The Exif 2.2 specification
* @file
*/
+use MediaWiki\MediaWikiServices;
+use Wikimedia\Timestamp\TimestampException;
/**
* Format Image metadata values into a human readable form.
unset( $tags['ResolutionUnit'] );
foreach ( $tags as $tag => &$vals ) {
-
// This seems ugly to wrap non-array's in an array just to unwrap again,
// especially when most of the time it is not an array
if ( !is_array( $tags[$tag] ) ) {
}
foreach ( $vals as &$val ) {
-
switch ( $tag ) {
case 'Compression':
switch ( $val ) {
case 'Flash':
$flashDecode = [
- 'fired' => $val & bindec( '00000001' ),
- 'return' => ( $val & bindec( '00000110' ) ) >> 1,
- 'mode' => ( $val & bindec( '00011000' ) ) >> 3,
- 'function' => ( $val & bindec( '00100000' ) ) >> 5,
- 'redeye' => ( $val & bindec( '01000000' ) ) >> 6,
-// 'reserved' => ($val & bindec( '10000000' )) >> 7,
+ 'fired' => $val & 0b00000001,
+ 'return' => ( $val & 0b00000110 ) >> 1,
+ 'mode' => ( $val & 0b00011000 ) >> 3,
+ 'function' => ( $val & 0b00100000 ) >> 5,
+ 'redeye' => ( $val & 0b01000000 ) >> 6,
+ // 'reserved' => ( $val & 0b10000000 ) >> 7,
];
$flashMsgs = [];
# We do not need to handle unknown values since all are used.
// are included here as we really don't want
// commas inserted.
case 'ImageDescription':
+ case 'UserComment':
case 'Artist':
case 'Copyright':
case 'RelatedSoundFile':
* @since 1.23
*/
public function fetchExtendedMetadata( File $file ) {
- $cache = ObjectCache::getMainWANInstance();
+ $cache = MediaWikiServices::getInstance()->getMainWANObjectCache();
// If revision deleted, exit immediately
if ( $file->isDeleted( File::DELETED_FILE ) ) {
return [];
}
- $cacheKey = wfMemcKey(
+ $cacheKey = $cache->makeKey(
'getExtendedMetadata',
$this->getLanguage()->getCode(),
(int)$this->singleLang,
protected function getExtendedMetadataFromHook( File $file, array $extendedMetadata,
&$maxCacheTime
) {
-
Hooks::run( 'GetExtendedMetadata', [
&$extendedMetadata,
$file,
$field['value'] = $this->resolveMultivalueValue( $field['value'] );
}
}
-
}
/**