[PHP-CVS] cvs: php4 /ext/gd gd.c php_gd.h

2001-04-06 Thread Jani Taskinen

sniper  Fri Apr  6 11:01:52 2001 EDT

  Modified files:  
/php4/ext/gdgd.c php_gd.h 
  Log:
  Killed some compile warnings.
  
Index: php4/ext/gd/gd.c
diff -u php4/ext/gd/gd.c:1.120 php4/ext/gd/gd.c:1.121
--- php4/ext/gd/gd.c:1.120  Sat Mar 31 22:20:45 2001
+++ php4/ext/gd/gd.cFri Apr  6 11:01:52 2001
@@ -18,7 +18,7 @@
+--+
  */
 
-/* $Id: gd.c,v 1.120 2001/04/01 06:20:45 sniper Exp $ */
+/* $Id: gd.c,v 1.121 2001/04/06 18:01:52 sniper Exp $ */
 
 /* gd 1.2 is copyright 1994, 1995, Quest Protein Database Center, 
Cold Spring Harbor Labs. */
@@ -92,6 +92,11 @@
 #define CTX_PUTC(c,fp) fputc(c, fp)
 #endif
 
+gdImagePtr _php_image_create_from_string ( zval **Data, char *tn, gdImagePtr 
+(*ioctx_func_p)() );
+static void _php_image_create_from(INTERNAL_FUNCTION_PARAMETERS, int image_type, char 
+*tn, gdImagePtr (*func_p)(), gdImagePtr (*ioctx_func_p)());
+static void _php_image_output(INTERNAL_FUNCTION_PARAMETERS, int image_type, char *tn, 
+void (*func_p)());
+static int _php_image_type ( char data[8] );
+static void _php_image_convert(INTERNAL_FUNCTION_PARAMETERS, int image_type);
 static void _php_image_bw_convert(gdImagePtr im_org, gdIOCtx *out, int threshold);
 
 #ifdef THREAD_SAFE
Index: php4/ext/gd/php_gd.h
diff -u php4/ext/gd/php_gd.h:1.25 php4/ext/gd/php_gd.h:1.26
--- php4/ext/gd/php_gd.h:1.25   Sat Mar 31 21:42:07 2001
+++ php4/ext/gd/php_gd.hFri Apr  6 11:01:52 2001
@@ -17,7 +17,7 @@
+--+
 */
 
-/* $Id: php_gd.h,v 1.25 2001/04/01 05:42:07 sniper Exp $ */
+/* $Id: php_gd.h,v 1.26 2001/04/06 18:01:52 sniper Exp $ */
 
 #ifndef PHP_GD_H
 #define PHP_GD_H
@@ -142,13 +142,6 @@
 PHP_FUNCTION(jpeg2wbmp);
 PHP_FUNCTION(png2wbmp);
 PHP_FUNCTION(image2wbmp);
-
-
-gdImagePtr _php_image_create_from_string ( zval **Data, char *tn, gdImagePtr 
(*ioctx_func_p)() );
-static void _php_image_create_from(INTERNAL_FUNCTION_PARAMETERS, int image_type, char 
*tn, gdImagePtr (*func_p)(), gdImagePtr (*ioctx_func_p)());
-static void _php_image_output(INTERNAL_FUNCTION_PARAMETERS, int image_type, char *tn, 
void (*func_p)());
-static int _php_image_type ( char data[8] );
-static void _php_image_convert(INTERNAL_FUNCTION_PARAMETERS, int image_type);
 
 PHPAPI int phpi_get_le_gd(void);
 



-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP-CVS] cvs: php4 /ext/gd gd.c php_gd.h

2001-01-24 Thread Derick Rethans

derick  Wed Jan 24 01:24:27 2001 EDT

  Modified files:  
/php4/ext/gdgd.c php_gd.h 
  Log:
  - Commited a patch that adds support for converting Images to WBMP format.
(Thanx to Denis Gasparin [EMAIL PROTECTED])
  @- Added support for converting images from JPG/PNG on the fly with the GD
  @  extension, which is usefull for creating dynamic WAP-sites (Derick)
  
  

Index: php4/ext/gd/gd.c
diff -u php4/ext/gd/gd.c:1.106 php4/ext/gd/gd.c:1.107
--- php4/ext/gd/gd.c:1.106  Tue Jan 16 14:34:19 2001
+++ php4/ext/gd/gd.cWed Jan 24 01:24:26 2001
@@ -18,7 +18,7 @@
+--+
  */
 
-/* $Id: gd.c,v 1.106 2001/01/16 22:34:19 sniper Exp $ */
+/* $Id: gd.c,v 1.107 2001/01/24 09:24:26 derick Exp $ */
 
 /* gd 1.2 is copyright 1994, 1995, Quest Protein Database Center, 
Cold Spring Harbor Labs. */
@@ -176,6 +176,11 @@
PHP_FE(imagepstext,
 NULL)
PHP_FE(imagepsbbox,
 NULL)
PHP_FE(imagetypes, 
 NULL)
+   
+   PHP_FE(jpeg2wbmp,  
+ NULL)
+   PHP_FE(png2wbmp,   
+ NULL)
+   PHP_FE(image2wbmp, 
+ NULL)
+   
{NULL, NULL, NULL}
 };
 
@@ -788,6 +793,9 @@
int output = 1, q = -1;
GDLS_FETCH();
 
+   /* The quality parameter for Wbmp stands for the threshold
+  So the q variable */
+
if (argc  1 || argc  3 || zend_get_parameters_ex(argc, imgind, file, 
quality) == FAILURE) 
{
WRONG_PARAM_COUNT;
@@ -815,10 +823,20 @@
php_error(E_WARNING, "%s: unable to open '%s' for writing", 
get_active_function_name(), fn);
RETURN_FALSE;
}
-   if (image_type == PHP_GDIMG_TYPE_JPG) {
-   (*func_p)(im, fp, q);
-   } else {
-   (*func_p)(im, fp);
+   
+   switch(image_type) {
+   case PHP_GDIMG_TYPE_JPG:
+   (*func_p)(im, fp, q);
+   break;
+   case PHP_GDIMG_TYPE_WBM:
+   if(q0||q255) {
+   php_error(E_WARNING, "%s: invalid threshold 
+value '%d'. It must be between 0 and 255",get_active_function_name(), q);
+   }
+   (*func_p)(im, q, fp);
+   break;
+   default:
+   (*func_p)(im, fp);
+   break;
}
fflush(fp);
fclose(fp);
@@ -834,11 +852,21 @@
}
output = php_header();
if (output) {
-   if (image_type == PHP_GDIMG_TYPE_JPG) {
-   (*func_p)(im, tmp, q);
-   } else {
-   (*func_p)(im, tmp);
+   switch(image_type) {
+   case PHP_GDIMG_TYPE_JPG:
+   (*func_p)(im, tmp, q);
+   break;
+   case PHP_GDIMG_TYPE_WBM:
+   if(q0||q255) {
+   php_error(E_WARNING, "%s: invalid 
+threshold value '%d'. It must be between 0 and 255",get_active_function_name(), q);
+   }
+   (*func_p)(im, q, fp);
+   break;
+   default:
+   (*func_p)(im, fp);
+   break;
}
+
 fseek(tmp, 0, SEEK_SET);
 #if APACHE  defined(CHARSET_EBCDIC)
SLS_FETCH();
@@ -2617,8 +2645,270 @@
 }
 /* }}} */
 
-#endif /* HAVE_LIBGD */
 
+/* {{{ proto int image2wbmp(int im [, string filename [, int threshold]])
+   Output WBMP image to browser or file */
+PHP_FUNCTION(image2wbmp)
+{
+#ifdef HAVE_GD_WBMP
+   _php_image_output (INTERNAL_FUNCTION_PARAM_PASSTHRU, PHP_GDIMG_TYPE_WBM, 
+"WBMP", _php_image_bw_convert);
+#else /* HAVE_GD_WBMP */
+   php_error(E_WARNING, "Image2Wbmp: No WBMP support in this PHP build");
+   RETURN_FALSE;
+#endif /* HAVE_GD_WBMP */
+}
+
+
+/* {{{ proto void jpeg2wbmp (string f_org, string f_dest, d_height, d_width)
+   Convert Jpeg Image to Wbmp image */
+PHP_FUNCTION(jpeg2wbmp)
+{
+#ifdef HAVE_GD_JPG
+   _php_image_convert