MediaWiki
REL1_22
|
Class to deal with reconciling and extracting metadata from bitmap images. More...
Public Member Functions | |
addMetadata ($metaArray, $type= 'other') | |
Add misc metadata. | |
getExif ($filename, $byteOrder) | |
Get exif info using exif class. | |
getMetadataArray () | |
Merge together the various types of metadata the different types have different priorites, and are merged in order. | |
Static Public Member Functions | |
static | getTiffByteOrder ($filename) |
Read the first 2 bytes of a tiff file to figure out Little Endian or Big Endian. | |
static | GIF ($filename) |
function for gif images. | |
static | Jpeg ($filename) |
Main entry point for jpeg's. | |
static | PNG ($filename) |
Entry point for png At some point in the future this might merge the png various tEXt chunks to that are interesting, but for now it only does XMP. | |
static | Tiff ($filename) |
This doesn't do much yet, but eventually I plan to add XMP support for Tiff. | |
Private Member Functions | |
doApp13 ($app13) | |
This does the photoshop image resource app13 block of interest, IPTC-IIM metadata is stored here. | |
Private Attributes | |
$iptcType = 'iptc-no-hash' | |
$metadata = array() | |
$metaPriority |
Class to deal with reconciling and extracting metadata from bitmap images.
This is meant to comply with http://www.metadataworkinggroup.org/pdf/mwg_guidance.pdf
This sort of acts as an intermediary between MediaHandler::getMetadata and the various metadata extractors.
Definition at line 34 of file BitmapMetadataHandler.php.
BitmapMetadataHandler::addMetadata | ( | $ | metaArray, |
$ | type = 'other' |
||
) |
Add misc metadata.
Warning: atm if the metadata category doesn't have a priority, it will be silently discarded.
array | $metaArray | array of metadata values |
string | $type | type. defaults to other. if two things have the same type they're merged |
Definition at line 98 of file BitmapMetadataHandler.php.
BitmapMetadataHandler::doApp13 | ( | $ | app13 | ) | [private] |
This does the photoshop image resource app13 block of interest, IPTC-IIM metadata is stored here.
Mostly just calls doPSIR and doIPTC
string | $app13 | String containing app13 block from jpeg file |
Definition at line 57 of file BitmapMetadataHandler.php.
References addMetadata(), JpegMetadataExtractor\doPSIR(), IPTC\parse(), and wfDebug().
BitmapMetadataHandler::getExif | ( | $ | filename, |
$ | byteOrder | ||
) |
Get exif info using exif class.
Basically what used to be in BitmapHandler::getMetadata(). Just calls stuff in the Exif class.
Parameters are passed to the Exif class.
$filename | string |
$byteOrder | string |
Definition at line 82 of file BitmapMetadataHandler.php.
References addMetadata(), and global.
Merge together the various types of metadata the different types have different priorites, and are merged in order.
This function is generally called by the media handlers' getMetadata()
Definition at line 116 of file BitmapMetadataHandler.php.
References as.
static BitmapMetadataHandler::getTiffByteOrder | ( | $ | filename | ) | [static] |
Read the first 2 bytes of a tiff file to figure out Little Endian or Big Endian.
Needed for exif stuff.
string | $filename | The filename |
Definition at line 287 of file BitmapMetadataHandler.php.
Referenced by Tiff().
static BitmapMetadataHandler::GIF | ( | $ | filename | ) | [static] |
function for gif images.
They don't really have native metadata, so just merges together XMP and image comment.
string | $filename | full path to file |
Definition at line 221 of file BitmapMetadataHandler.php.
References array(), as, GIFMetadataExtractor\getMetadata(), and GIFMetadataExtractor\VERSION.
Referenced by GIFHandler\getMetadata().
static BitmapMetadataHandler::Jpeg | ( | $ | filename | ) | [static] |
Main entry point for jpeg's.
string | $filename | filename (with full path) |
MWException | on invalid file. |
Definition at line 150 of file BitmapMetadataHandler.php.
References $res, as, and JpegMetadataExtractor\segmentSplitter().
Referenced by JpegHandler\getMetadata(), BitmapMetadataHandlerTest\testBadIPTC(), BitmapMetadataHandlerTest\testIPTCDates(), BitmapMetadataHandlerTest\testIPTCDatesInvalid(), BitmapMetadataHandlerTest\testJpegComment(), and BitmapMetadataHandlerTest\testMultilingualCascade().
static BitmapMetadataHandler::PNG | ( | $ | filename | ) | [static] |
Entry point for png At some point in the future this might merge the png various tEXt chunks to that are interesting, but for now it only does XMP.
string | $filename | full path to file |
Definition at line 192 of file BitmapMetadataHandler.php.
References as, PNGMetadataExtractor\getMetadata(), and PNGMetadataExtractor\VERSION.
Referenced by PNGHandler\getMetadata().
static BitmapMetadataHandler::Tiff | ( | $ | filename | ) | [static] |
This doesn't do much yet, but eventually I plan to add XMP support for Tiff.
(PHP's exif support already extracts but needs some further processing because PHP's exif support is stupid...)
The various exceptions this throws are caught later.
$filename | String |
MWException |
Definition at line 262 of file BitmapMetadataHandler.php.
References getTiffByteOrder(), and version.
Referenced by TiffHandler\getMetadata().
BitmapMetadataHandler::$iptcType = 'iptc-no-hash' [private] |
Definition at line 47 of file BitmapMetadataHandler.php.
BitmapMetadataHandler::$metadata = array() [private] |
Definition at line 36 of file BitmapMetadataHandler.php.
BitmapMetadataHandler::$metaPriority [private] |
array( 20 => array( 'other' ), 40 => array( 'native' ), 60 => array( 'iptc-good-hash', 'iptc-no-hash' ), 70 => array( 'xmp-deprecated' ), 80 => array( 'xmp-general' ), 90 => array( 'xmp-exif' ), 100 => array( 'iptc-bad-hash' ), 120 => array( 'exif' ), )
Definition at line 37 of file BitmapMetadataHandler.php.