* Specification in Gnome repository:
* http://svn.gnome.org/viewvc/gimp/trunk/devel-docs/xcf.txt?view=markup
*
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
* @file
* @ingroup Media
*/
*/
class XCFHandler extends BitmapHandler {
+ /**
+ * @param $file
+ * @return bool
+ */
+ function mustRender( $file ) {
+ return true;
+ }
+
/**
* Render files as PNG
*
* @author Hexmode
* @author Hashar
*
- * @param $filename String Full path to a XCF file
- * @return false|metadata array just like PHP getimagesize()
+ * @param string $filename Full path to a XCF file
+ * @return bool|array metadata array just like PHP getimagesize()
*/
static function getXCFMetaData( $filename ) {
# Decode master structure
# The image structure always starts at offset 0 in the XCF file.
# So we just read it :-)
$binaryHeader = fread( $f, 26 );
- fclose($f);
+ fclose( $f );
# Master image structure:
#
# 1: Grayscale
# 2: Indexed color
# (enum GimpImageBaseType in libgimpbase/gimpbaseenums.h)
- $header = unpack(
- "A9magic" # A: space padded
- . "/a5version" # a: zero padded
- . "/Nwidth" # \
- . "/Nheight" # N: unsigned long 32bit big endian
- . "/Nbase_type" # /
- , $binaryHeader
- );
+ try {
+ $header = wfUnpack(
+ "A9magic" # A: space padded
+ . "/a5version" # a: zero padded
+ . "/Nwidth" # \
+ . "/Nheight" # N: unsigned long 32bit big endian
+ . "/Nbase_type" # /
+ , $binaryHeader
+ );
+ } catch( MWException $mwe ) {
+ return false;
+ }
# Check values
if( $header['magic'] !== 'gimp xcf' ) {