MediaWiki  1.34.0
JpegMetadataExtractor Class Reference

Class for reading jpegs and extracting metadata. More...

Static Public Member Functions

static doPSIR ( $app13)
 This reads the photoshop image resource. More...
 
static segmentSplitter ( $filename)
 Function to extract metadata segments of interest from jpeg files based on GIFMetadataExtractor. More...
 

Public Attributes

const MAX_JPEG_SEGMENTS = 200
 

Static Private Member Functions

static jpegExtractMarker (&$fh)
 Helper function for jpegSegmentSplitter. More...
 

Detailed Description

Class for reading jpegs and extracting metadata.

see also BitmapMetadataHandler.

Based somewhat on GIFMetadataExtractor.

Definition at line 34 of file JpegMetadataExtractor.php.

Member Function Documentation

◆ doPSIR()

static JpegMetadataExtractor::doPSIR (   $app13)
static

This reads the photoshop image resource.

Currently it only compares the iptc/iim hash with the stored hash, which is used to determine the precedence of the iptc data. In future it may extract some other info, like url of copyright license.

This should generally be called by BitmapMetadataHandler::doApp13()

Parameters
string$app13Photoshop psir app13 block from jpg.
Exceptions
MWException(It gets caught next level up though)
Returns
string If the iptc hash is good or not. One of 'iptc-no-hash', 'iptc-good-hash', 'iptc-bad-hash'.

Definition at line 212 of file JpegMetadataExtractor.php.

References wfUnpack().

Referenced by BitmapMetadataHandler\doApp13().

◆ jpegExtractMarker()

static JpegMetadataExtractor::jpegExtractMarker ( $fh)
staticprivate

Helper function for jpegSegmentSplitter.

Parameters
resource&$fhFile handle for JPEG file
Exceptions
MWException
Returns
string Data content of segment.

Definition at line 181 of file JpegMetadataExtractor.php.

References $fh, and wfUnpack().

Referenced by segmentSplitter().

◆ segmentSplitter()

static JpegMetadataExtractor::segmentSplitter (   $filename)
static

Function to extract metadata segments of interest from jpeg files based on GIFMetadataExtractor.

we can almost use getimagesize to do this but gis doesn't support having multiple app1 segments and those can't extract xmp on files containing both exif and xmp data

Parameters
string$filenameName of jpeg file
Returns
array Array of interesting segments.
Exceptions
MWExceptionIf given invalid file.

Definition at line 52 of file JpegMetadataExtractor.php.

References $fh, jpegExtractMarker(), wfDebug(), and wfUnpack().

Referenced by BitmapMetadataHandler\Jpeg().

Member Data Documentation

◆ MAX_JPEG_SEGMENTS

const JpegMetadataExtractor::MAX_JPEG_SEGMENTS = 200

Definition at line 35 of file JpegMetadataExtractor.php.


The documentation for this class was generated from the following file: