Author: Kore Nordmann
Date: 2006-05-29 16:04:41 +0200 (Mon, 29 May 2006)
New Revision: 2965

Log:
- Use PHPs image type constants instead of custom ones

Modified:
   trunk/Graph/src/interfaces/driver.php
   trunk/Graph/src/options/gd_driver.php
   trunk/Graph/tests/driver_gd_test.php

Modified: trunk/Graph/src/interfaces/driver.php
===================================================================
--- trunk/Graph/src/interfaces/driver.php       2006-05-29 13:45:32 UTC (rev 
2964)
+++ trunk/Graph/src/interfaces/driver.php       2006-05-29 14:04:41 UTC (rev 
2965)
@@ -35,10 +35,6 @@
      */
     protected $height;
     
-    const PNG = 1;
-    const JPEG = 2;
-    const JPG = 2;
-
     public function __construct( array $options = array() )
     {
         $this->options = new ezcGraphDriverOptions( $options );

Modified: trunk/Graph/src/options/gd_driver.php
===================================================================
--- trunk/Graph/src/options/gd_driver.php       2006-05-29 13:45:32 UTC (rev 
2964)
+++ trunk/Graph/src/options/gd_driver.php       2006-05-29 14:04:41 UTC (rev 
2965)
@@ -18,8 +18,8 @@
      * Type of generated image.
      *
      * Should be one of those:
-     *  - ezcGraphGdDriver::PNG
-     *  - ezcGraphGdDriver::JPEG
+     *  - IMG_PNG
+     *  - IMG_JPEG
      * 
      * @var int
      */
@@ -39,15 +39,13 @@
         switch ( $propertyName )
         {
             case 'imageFormat':
-                if ( in_array(  $propertyValue,
-                                array(  ezcGraphGdDriver::PNG,
-                                        ezcGraphGdDriver::JPEG ) ) ) 
+                if ( imagetypes() & $propertyValue )
                 {
                     $this->imageFormat = (int) $propertyValue;
                 }
                 else
                 {
-                    throw new ezcBaseValueException( $propertyValue, 'integer' 
);
+                    throw new ezcBaseValueException( $propertyValue, 
'Unsupported image type.' );
                 }
                 break;
             default:

Modified: trunk/Graph/tests/driver_gd_test.php
===================================================================
--- trunk/Graph/tests/driver_gd_test.php        2006-05-29 13:45:32 UTC (rev 
2964)
+++ trunk/Graph/tests/driver_gd_test.php        2006-05-29 14:04:41 UTC (rev 
2965)
@@ -49,7 +49,7 @@
         $this->driver = new ezcGraphGdDriver();
         $this->driver->options->width = 200;
         $this->driver->options->height = 100;
-        $this->driver->options->imageFormat = ezcGraphGdDriver::PNG;
+        $this->driver->options->imageFormat = IMG_PNG;
     }
 
     /**

-- 
svn-components mailing list
svn-components@lists.ez.no
http://lists.ez.no/mailman/listinfo/svn-components

Reply via email to