public function testUnicodeUserComment() { $filename = $this->mediaPath . 'exif-user-comment.jpg'; $seg = JpegMetadataExtractor::segmentSplitter($filename); $exif = new Exif($filename, $seg['byteOrder']); $data = $exif->getFilteredData(); $expected = array('UserComment' => 'test⁔comment'); $this->assertEquals($expected, $data); }
public function testUnicodeUserComment() { if (!wfDl('exif')) { $this->markTestIncomplete("This test needs the exif extension."); } $filename = $this->mediaPath . 'exif-user-comment.jpg'; $seg = JpegMetadataExtractor::segmentSplitter($filename); $exif = new Exif($filename, $seg['byteOrder']); $data = $exif->getFilteredData(); $expected = array('UserComment' => 'test⁔comment'); $this->assertEquals($expected, $data); }
public function testExifByteOrder() { $res = JpegMetadataExtractor::segmentSplitter($this->filePath . 'exif-user-comment.jpg'); $expected = 'BE'; $this->assertEquals($expected, $res['byteOrder']); }
/** Main entry point for jpeg's. * * @param string $filename filename (with full path) * @return array metadata result array. * @throws MWException on invalid file. */ static function Jpeg($filename) { $showXMP = function_exists('xml_parser_create_ns'); $meta = new self(); $seg = JpegMetadataExtractor::segmentSplitter($filename); if (isset($seg['COM']) && isset($seg['COM'][0])) { $meta->addMetadata(array('JPEGFileComment' => $seg['COM']), 'native'); } if (isset($seg['PSIR']) && count($seg['PSIR']) > 0) { foreach ($seg['PSIR'] as $curPSIRValue) { $meta->doApp13($curPSIRValue); } } if (isset($seg['XMP']) && $showXMP) { $xmp = new XMPReader(); $xmp->parse($seg['XMP']); foreach ($seg['XMP_ext'] as $xmpExt) { /* Support for extended xmp in jpeg files * is not well tested and a bit fragile. */ $xmp->parseExtended($xmpExt); } $res = $xmp->getResults(); foreach ($res as $type => $array) { $meta->addMetadata($array, $type); } } if (isset($seg['byteOrder'])) { $meta->getExif($filename, $seg['byteOrder']); } return $meta->getMetadataArray(); }