/** * @param File $image * @param string $filename * @return string */ function getMetadata($image, $filename) { try { $metadata = BitmapMetadataHandler::PNG($filename); } catch (Exception $e) { // Broken file? wfDebug(__METHOD__ . ': ' . $e->getMessage() . "\n"); return self::BROKEN_FILE; } return serialize($metadata); }
/** * @covers BitmapMetadataHandler::png */ public function testPNGNative() { $handler = new BitmapMetadataHandler(); $result = $handler->PNG($this->filePath . 'Png-native-test.png'); $expected = 'http://example.com/url'; $this->assertEquals($expected, $result['metadata']['Identifier']['x-default']); }