MediaWiki
REL1_24
|
Stuff specific to JPEG and (built-in) TIFF handler. More...
Public Member Functions | |
convertMetadataVersion ($metadata, $version=1) | |
Convert metadata version. | |
formatMetadata ($image) | |
getCommonMetaArray (File $file) | |
Get an array of standard (FormatMetadata type) metadata values. | |
getImageSize ($image, $path) | |
Wrapper for base classes ImageHandler::getImageSize() that checks for rotation reported from metadata and swaps the sizes to match. | |
getMetadataType ($image) | |
Get a string describing the type of metadata, for display purposes. | |
getRotation ($file) | |
On supporting image formats, try to read out the low-level orientation of the file and return the angle that the file needs to be rotated to be viewed. | |
isMetadataValid ($image, $metadata) | |
Public Attributes | |
const | BROKEN_FILE = '-1' |
const | OLD_BROKEN_FILE = '0' |
Protected Member Functions | |
getRotationForExif ($data) | |
Given a chunk of serialized Exif metadata, return the orientation as degrees of rotation. |
Stuff specific to JPEG and (built-in) TIFF handler.
All metadata related, since both JPEG and TIFF support Exif.
Definition at line 30 of file ExifBitmap.php.
ExifBitmapHandler::convertMetadataVersion | ( | $ | metadata, |
$ | version = 1 |
||
) |
Convert metadata version.
By default just returns $metadata, but can be used to allow media handlers to convert between metadata versions.
string | array | $metadata | Metadata array (serialized if string) |
int | $version | Target version |
Reimplemented from MediaHandler.
Definition at line 34 of file ExifBitmap.php.
References as, and FormatMetadata\collapseContactInfo().
ExifBitmapHandler::formatMetadata | ( | $ | image | ) |
File | $image |
Reimplemented from MediaHandler.
Definition at line 130 of file ExifBitmap.php.
References MediaHandler\formatMetadataHelper(), and getCommonMetaArray().
ExifBitmapHandler::getCommonMetaArray | ( | File $ | file | ) |
Get an array of standard (FormatMetadata type) metadata values.
The returned data is largely the same as that from getMetadata(), but formatted in a standard, stable, handler-independent way. The idea being that some values like ImageDescription or Artist are universal and should be retrievable in a handler generic way.
The specific properties are the type of properties that can be handled by the FormatMetadata class. These values are exposed to the user via the filemetadata parser function.
Details of the response format of this function can be found at https://www.mediawiki.org/wiki/Manual:File_metadata_handling tl/dr: the response is an associative array of properties keyed by name, but the value can be complex. You probably want to call one of the FormatMetadata::flatten* functions on the property values before using them, or call FormatMetadata::getFormattedData() on the full response array, which transforms all values into prettified, human-readable text.
Subclasses overriding this function must return a value which is a valid API response fragment (all associative array keys are valid XML tagnames).
Note, if the file simply has no metadata, but the handler supports this interface, it should return an empty array, not false.
File | $file |
Reimplemented from MediaHandler.
Definition at line 139 of file ExifBitmap.php.
References array(), File\getMetadata(), and isMetadataValid().
Referenced by formatMetadata().
ExifBitmapHandler::getImageSize | ( | $ | image, |
$ | path | ||
) |
Wrapper for base classes ImageHandler::getImageSize() that checks for rotation reported from metadata and swaps the sizes to match.
File | $image | |
string | $path |
Reimplemented from ImageHandler.
Definition at line 171 of file ExifBitmap.php.
References $path, BitmapHandler\autoRotateEnabled(), MediaHandler\getMetadata(), and getRotationForExif().
ExifBitmapHandler::getMetadataType | ( | $ | image | ) |
Get a string describing the type of metadata, for display purposes.
File | $image |
Reimplemented from MediaHandler.
Definition at line 159 of file ExifBitmap.php.
ExifBitmapHandler::getRotation | ( | $ | file | ) |
On supporting image formats, try to read out the low-level orientation of the file and return the angle that the file needs to be rotated to be viewed.
This information is only useful when manipulating the original file; the width and height we normally work with is logical, and will match any produced output views.
File | $file |
Reimplemented from MediaHandler.
Definition at line 204 of file ExifBitmap.php.
References $file, BitmapHandler\autoRotateEnabled(), and getRotationForExif().
Referenced by JpegHandler\rotate().
ExifBitmapHandler::getRotationForExif | ( | $ | data | ) | [protected] |
Given a chunk of serialized Exif metadata, return the orientation as degrees of rotation.
string | $data |
Definition at line 222 of file ExifBitmap.php.
References wfRestoreWarnings(), and wfSuppressWarnings().
Referenced by getImageSize(), and getRotation().
ExifBitmapHandler::isMetadataValid | ( | $ | image, |
$ | metadata | ||
) |
File | $image | |
array | $metadata |
Reimplemented from MediaHandler.
Definition at line 87 of file ExifBitmap.php.
References global, MediaHandler\METADATA_BAD, MediaHandler\METADATA_COMPATIBLE, MediaHandler\METADATA_GOOD, Exif\version(), wfDebug(), wfRestoreWarnings(), and wfSuppressWarnings().
Referenced by getCommonMetaArray().
const ExifBitmapHandler::BROKEN_FILE = '-1' |
Definition at line 31 of file ExifBitmap.php.
Referenced by TiffHandler\getMetadata(), JpegHandler\getMetadata(), and JpegTest\testInvalidFile().
const ExifBitmapHandler::OLD_BROKEN_FILE = '0' |
Definition at line 32 of file ExifBitmap.php.