Fixed @param tags to conform with Doxygen format.
[lhc/web/wiklou.git] / includes / media / XCF.php
index 385e988..ba38d15 100644 (file)
@@ -7,6 +7,21 @@
  * 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
         *
@@ -49,8 +72,8 @@ class XCFHandler extends BitmapHandler {
         * @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
@@ -61,7 +84,7 @@ class XCFHandler extends BitmapHandler {
                # 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:
                #
@@ -78,14 +101,18 @@ class XCFHandler extends BitmapHandler {
                #                         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' ) {