bjori           Sun Jun 25 20:52:34 2006 UTC

  Added files:                 
    /php-src/ext/standard/tests/image   image_type_to_extension.phpt 

  Modified files:              
    /php-src/ext/standard       basic_functions.c 
  Log:
  Enabled image_type_to_extension() which has been in cvs for 2,5 years now..
  Added test
  
  
http://cvs.php.net/viewvc.cgi/php-src/ext/standard/basic_functions.c?r1=1.778&r2=1.779&diff_format=u
Index: php-src/ext/standard/basic_functions.c
diff -u php-src/ext/standard/basic_functions.c:1.778 
php-src/ext/standard/basic_functions.c:1.779
--- php-src/ext/standard/basic_functions.c:1.778        Sun Jun 25 19:17:19 2006
+++ php-src/ext/standard/basic_functions.c      Sun Jun 25 20:52:34 2006
@@ -17,7 +17,7 @@
    +----------------------------------------------------------------------+
  */
 
-/* $Id: basic_functions.c,v 1.778 2006/06/25 19:17:19 bjori Exp $ */
+/* $Id: basic_functions.c,v 1.779 2006/06/25 20:52:34 bjori Exp $ */
 
 #include "php.h"
 #include "php_streams.h"
@@ -1681,6 +1681,12 @@
 ZEND_END_ARG_INFO()
 
 static
+ZEND_BEGIN_ARG_INFO_EX(arginfo_image_type_to_extension, 0, 0, 1)
+       ZEND_ARG_INFO(0, imagetype)
+       ZEND_ARG_INFO(0, include_dot)
+ZEND_END_ARG_INFO()
+
+static
 ZEND_BEGIN_ARG_INFO_EX(arginfo_getimagesize, 0, 0, 1)
        ZEND_ARG_INFO(0, imagefile)
        ZEND_ARG_INFO(1, info) /* ARRAY_INFO(1, info, 1) */
@@ -3112,6 +3118,7 @@
        PHP_FE(iptcembed,                                                       
                                                        arginfo_iptcembed)
        PHP_FE(getimagesize,                                                    
                                                arginfo_getimagesize)
        PHP_FE(image_type_to_mime_type,                                         
                                        arginfo_image_type_to_mime_type)
+       PHP_FE(image_type_to_extension,                                         
                                        arginfo_image_type_to_extension)
 
        PHP_FE(phpinfo,                                                         
                                                        arginfo_phpinfo)
        PHP_FE(phpversion,                                                      
                                                        arginfo_phpversion)

http://cvs.php.net/viewvc.cgi/php-src/ext/standard/tests/image/image_type_to_extension.phpt?view=markup&rev=1.1
Index: php-src/ext/standard/tests/image/image_type_to_extension.phpt
+++ php-src/ext/standard/tests/image/image_type_to_extension.phpt
--TEST--
image_type_to_extension()
--SKIPIF--
<?php 
        if (!function_exists('image_type_to_extension')) die('skip 
image_type_to_extension() not available'); 
        require_once('skipif_imagetype.inc');
?>
--FILE--
<?php
    $constants = array(
        "IMAGETYPE_GIF"      => IMAGETYPE_GIF,
        "IMAGETYPE_JPEG"     => IMAGETYPE_JPEG,
        "IMAGETYPE_PNG"      => IMAGETYPE_PNG,
        "IMAGETYPE_SWF"      => IMAGETYPE_SWF,
        "IMAGETYPE_PSD"      => IMAGETYPE_PSD,
        "IMAGETYPE_BMP"      => IMAGETYPE_BMP,
        "IMAGETYPE_TIFF_II"  => IMAGETYPE_TIFF_II,
        "IMAGETYPE_TIFF_MM"  => IMAGETYPE_TIFF_MM,
        "IMAGETYPE_JPC"      => IMAGETYPE_JPC,
        "IMAGETYPE_JP2"      => IMAGETYPE_JP2,
        "IMAGETYPE_JPX"      => IMAGETYPE_JPX,
        "IMAGETYPE_JB2"      => IMAGETYPE_JB2,
        "IMAGETYPE_IFF"      => IMAGETYPE_IFF,
        "IMAGETYPE_WBMP"     => IMAGETYPE_WBMP,
        "IMAGETYPE_JPEG2000" => IMAGETYPE_JPEG2000,
        "IMAGETYPE_XBM"      => IMAGETYPE_XBM
    );
    foreach($constants as $name => $constant) {
        printf("Constant: %s\n\tWith dot: %s\n\tWithout dot: %s\n", $name, 
image_type_to_extension($constant), image_type_to_extension($constant, false));
    }
?>
--EXPECT--
Constant: IMAGETYPE_GIF
        With dot: .gif
        Without dot: gif
Constant: IMAGETYPE_JPEG
        With dot: .jpeg
        Without dot: jpeg
Constant: IMAGETYPE_PNG
        With dot: .png
        Without dot: png
Constant: IMAGETYPE_SWF
        With dot: .swf
        Without dot: swf
Constant: IMAGETYPE_PSD
        With dot: .psd
        Without dot: psd
Constant: IMAGETYPE_BMP
        With dot: .bmp
        Without dot: bmp
Constant: IMAGETYPE_TIFF_II
        With dot: .tiff
        Without dot: tiff
Constant: IMAGETYPE_TIFF_MM
        With dot: .tiff
        Without dot: tiff
Constant: IMAGETYPE_JPC
        With dot: .jpc
        Without dot: jpc
Constant: IMAGETYPE_JP2
        With dot: .jp2
        Without dot: jp2
Constant: IMAGETYPE_JPX
        With dot: .jpx
        Without dot: jpx
Constant: IMAGETYPE_JB2
        With dot: .jb2
        Without dot: jb2
Constant: IMAGETYPE_IFF
        With dot: .iff
        Without dot: iff
Constant: IMAGETYPE_WBMP
        With dot: .bmp
        Without dot: bmp
Constant: IMAGETYPE_JPEG2000
        With dot: .jpc
        Without dot: jpc
Constant: IMAGETYPE_XBM
        With dot: .xbm
        Without dot: xbm

-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to