Trying to get PHP to return the file type of an xcf image and it stubbornly refused to return what I wanted.
Still can't get it to output image/x-xcf but I'm starting to think the compiled in magic data base of PHP doesn't include it and I haven't successfully loaded a system magic.mgc file.
e.g.
file -bi gimp_image.xcf
image/x-xcf; charset=binary
I have managed to get it to tell me it's a GIMP Image using FILEINFO_CONTINUE or FILEINFO_NONE
< ?php
$file = 'gimp_image.xcf';
# $file = 'test.txt';
$finfo = finfo_open(FILEINFO_MIME_TYPE);
$mime = finfo_file($finfo, $file);
echo $mime . "\n";
#output
application/octet-stream
$finfo = finfo_open(FILEINFO_CONTINUE);
$mime = finfo_file($finfo, $file);
echo $mime . "\n";
# output
GIMP XCF image data, version 0, 1078 x 718, RGB Color
?>
0 Comments