53 return [
'png',
'image/png' ];
67 # Decode master structure
68 $f = fopen( $filename,
'rb' );
72 # The image structure always starts at offset 0 in the XCF file.
73 # So we just read it :-)
74 $binaryHeader = fread( $f, 26 );
96 "A9magic" . # A: space padded
97 "/a5version" . # a: zero padded
99 "/Nheight" . # N:
unsigned long 32bit big endian
108 if (
$header[
'magic'] !==
'gimp xcf' ) {
109 wfDebug( __METHOD__ .
" '$filename' has invalid magic signature." );
113 # TODO: we might want to check for sane values of width and height
116 ": canvas size of '$filename' is {$header['width']} x {$header['height']} px" );
128 switch (
$header[
'base_type'] ) {
130 $metadata[
'colorType'] =
'truecolour-alpha';
133 $metadata[
'colorType'] =
'greyscale-alpha';
136 $metadata[
'colorType'] =
'index-coloured';
139 $metadata[
'colorType'] =
'unknown';
143 $metadata[
'error'] =
true;
146 'width' =>
$header[
'width'] ?? 0,
147 'height' =>
$header[
'height'] ?? 0,
149 'metadata' => $metadata
160 if ( !
$file->getMetadataArray() ) {
188 $xcfMeta =
$file->getMetadataArray();
189 if ( isset( $xcfMeta[
'colorType'] ) && $xcfMeta[
'colorType'] ===
'index-coloured' ) {
192 return parent::canRender(
$file );
wfDebug( $text, $dest='all', array $context=[])
Sends a line to the debug log if enabled or, optionally, to a comment in output.
wfUnpack( $format, $data, $length=false)
Wrapper around php's unpack.
Generic handler for bitmap images.
Handler for the Gimp's native file format; getimagesize() doesn't support these files.
canRender( $file)
Can we render this file?
static getXCFMetaData( $filename)
Metadata for a given XCF file.
getThumbType( $ext, $mime, $params=null)
Render files as PNG.
isFileMetadataValid( $file)
Should we refresh the metadata.
getScalerType( $dstPath, $checkDstPath=true)
Must use "im" for XCF.
getSizeAndMetadata( $state, $filename)
Get image size information and metadata array.
if(PHP_SAPI !='cli-server') if(!isset( $_SERVER['SCRIPT_FILENAME'])) $file
Item class for a filearchive table row.
if(!is_readable( $file)) $ext