Based on what I have read on the newsgroups, I have not incorporated the function from Boutell's library but rather wrapped up your ImageRotate function.
diff -Naur php4.3.2-gd2.0.12-1compat/ext/gd/gd.c
php4.3.2-gd2.0.12-2sandstone/ext/gd/gd.c
--- php4.3.2-gd2.0.12-1compat/ext/gd/gd.c 2003-06-05 06:32:48.000000000 -0600
+++ php4.3.2-gd2.0.12-2sandstone/ext/gd/gd.c 2003-07-08 10:55:53.000000000 -0600
@@ -160,6 +160,7 @@
PHP_FE(imagecolorclosestalpha, NULL)
PHP_FE(imagecolorexactalpha, NULL)
PHP_FE(imagecopyresampled, NULL)
+ PHP_FE(imagecopyrotated, NULL)
#endif
#ifdef HAVE_GD_BUNDLED
@@ -386,7 +387,7 @@
/* }}} */
#if HAVE_GD_BUNDLED
-#define PHP_GD_VERSION_STRING "bundled (2.0.12 compatible)"
+#define PHP_GD_VERSION_STRING "bundled (2.0.12-wr compatible)"
#elif HAVE_LIBGD20
#define PHP_GD_VERSION_STRING "2.0 or higher"
#elif HAVE_GDIMAGECOLORRESOLVE
@@ -446,6 +447,8 @@
#if defined(USE_GD_JISX0208) && defined(HAVE_GD_BUNDLED)
php_info_print_table_row(2, "JIS-mapped Japanese Font Support", "enabled");
#endif
+ php_info_print_table_row(2, "Core Library Version", "PHP 4.3.2,GD 2.0.12");
+ php_info_print_table_row(2, "Version", "2.0.12-1wr");
php_info_print_table_end();
}
/* }}} */
@@ -2872,6 +2875,59 @@
}
/* }}} */
+
+/* {{{ proto int imagecopyrotated(int dst_im, int src_im, double dst_x, double dst_y,
int src_x, int src_y, int src_w, int src_h, int angle)
+ Copy and rotate part of an image by an arbitrary number of integer degrees */
+PHP_FUNCTION(imagecopyrotated)
+{
+#if HAVE_LIBGD20
+ zval **SIM, **DIM, **SX, **SY, **SW, **SH, **DX, **DY, **ANGLE;
+ gdImagePtr im_dst, im_src, im_tmp;
+ int srcH, srcW, srcY, srcX, angle, color;
+ double dstY, dstX, dstW, dstH;
+
+ if (ZEND_NUM_ARGS() != 9 ||
+ zend_get_parameters_ex(9, &DIM, &SIM, &DX, &DY, &SX, &SY, &SW, &SH,
&ANGLE) == FAILURE) {
+ ZEND_WRONG_PARAM_COUNT();
+ }
+
+ ZEND_FETCH_RESOURCE(im_dst, gdImagePtr, DIM, -1, "Image", le_gd);
+ ZEND_FETCH_RESOURCE(im_src, gdImagePtr, SIM, -1, "Image", le_gd);
+
+ convert_to_long_ex(SX);
+ convert_to_long_ex(SY);
+ convert_to_long_ex(SW);
+ convert_to_long_ex(SH);
+ convert_to_double_ex(DX);
+ convert_to_double_ex(DY);
+ convert_to_long_ex(ANGLE);
+
+ srcH = Z_LVAL_PP(SH);
+ srcW = Z_LVAL_PP(SW);
+ dstW = srcW;
+ dstH = srcH;
+ srcX = Z_LVAL_PP(SX);
+ srcY = Z_LVAL_PP(SY);
+ dstX = Z_DVAL_PP(DX) - dstW / 2;
+ dstY = Z_DVAL_PP(DY) - dstH / 2;
+ angle = Z_LVAL_PP(ANGLE);
+
+ /* Hopefully this is always correct */
+ color = im_src->transparent;
+
+ im_tmp = gdImageRotate(im_src, angle, color);
+ gdImageCopyResized(im_dst, im_tmp, dstX, dstY, srcX, srcY, dstW, dstH, srcW,
srcH);
+ gdImageDestroy(im_tmp);
+
+ /* gdImageCopyRotated(im_dst, im_src, dstX, dstY, srcX, srcY, srcW, srcH,
angle); */
+
+ RETURN_TRUE;
+#else
+ zend_error(E_WARNING, "%s(): requires GD 2.0 or later",
get_active_function_name(TSRMLS_C));
+#endif
+}
+/* }}} */
+
/* {{{ proto int imagesx(int im)
Get image width */
PHP_FUNCTION(imagesx)
diff -Naur php4.3.2-gd2.0.12-1compat/ext/gd/php_gd.h
php4.3.2-gd2.0.12-2sandstone/ext/gd/php_gd.h
--- php4.3.2-gd2.0.12-1compat/ext/gd/php_gd.h 2003-06-05 06:32:48.000000000 -0600
+++ php4.3.2-gd2.0.12-2sandstone/ext/gd/php_gd.h 2003-07-08 05:27:05.000000000
-0600
@@ -101,6 +101,7 @@
PHP_FUNCTION(imagecolorclosestalpha);
PHP_FUNCTION(imagecolorexactalpha);
PHP_FUNCTION(imagecopyresampled);
+PHP_FUNCTION(imagecopyrotated);
#endif
#ifdef HAVE_GD_BUNDLED-- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php
