/** function for gif images. * * They don't really have native metadata, so just merges together * XMP and image comment. * * @param string $filename full path to file * @return Array metadata array */ public static function GIF($filename) { $meta = new self(); $baseArray = GIFMetadataExtractor::getMetadata($filename); if (count($baseArray['comment']) > 0) { $meta->addMetadata(array('GIFFileComment' => $baseArray['comment']), 'native'); } if ($baseArray['xmp'] !== '' && function_exists('xml_parser_create_ns')) { $xmp = new XMPReader(); $xmp->parse($baseArray['xmp']); $xmpRes = $xmp->getResults(); foreach ($xmpRes as $type => $xmpSection) { $meta->addMetadata($xmpSection, $type); } } unset($baseArray['comment']); unset($baseArray['xmp']); $baseArray['metadata'] = $meta->getMetadataArray(); $baseArray['metadata']['_MW_GIF_VERSION'] = GIFMetadataExtractor::VERSION; return $baseArray; }
/** function for gif images. * * They don't really have native metadata, so just merges together * XMP and image comment. * * @param string $filename Full path to file * @return array Metadata array */ public static function GIF($filename) { $meta = new self(); $baseArray = GIFMetadataExtractor::getMetadata($filename); if (count($baseArray['comment']) > 0) { $meta->addMetadata(['GIFFileComment' => $baseArray['comment']], 'native'); } if ($baseArray['xmp'] !== '' && XMPReader::isSupported()) { $xmp = new XMPReader(LoggerFactory::getInstance('XMP')); $xmp->parse($baseArray['xmp']); $xmpRes = $xmp->getResults(); foreach ($xmpRes as $type => $xmpSection) { $meta->addMetadata($xmpSection, $type); } } unset($baseArray['comment']); unset($baseArray['xmp']); $baseArray['metadata'] = $meta->getMetadataArray(); $baseArray['metadata']['_MW_GIF_VERSION'] = GIFMetadataExtractor::VERSION; return $baseArray; }