Skip to content

Commit 5b52cc3

Browse files
committed
add vips_image_remove()
see libvips/php-vips#13
1 parent 0e180dc commit 5b52cc3

File tree

2 files changed

+38
-3
lines changed

2 files changed

+38
-3
lines changed

ChangeLog

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,10 @@ Version 0.1.1 (2016-10-03)
44
--------------------------
55
* Support draw operations
66
* Add vips_error_buffer(), remove docref messages
7-
* return 0/-1 everywhere for error
8-
* vips_image_get() returns ["out" => value] | -1
9-
* fix type conversions
7+
* Return 0/-1 everywhere for error
8+
* Vips_image_get() returns ["out" => value] | -1
9+
* Fix type conversions
10+
* Add vips_image_remove()
1011

1112
Version 0.1.0 (2016-09-20)
1213
--------------------------

vips.c

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1397,6 +1397,34 @@ PHP_FUNCTION(vips_image_set)
13971397
}
13981398
/* }}} */
13991399

1400+
/* {{{ proto long vips_image_remove(resource image, string field)
1401+
Remove field from image */
1402+
PHP_FUNCTION(vips_image_remove)
1403+
{
1404+
zval *im;
1405+
char *field_name;
1406+
size_t field_name_len;
1407+
VipsImage *image;
1408+
GType type;
1409+
1410+
if (zend_parse_parameters(ZEND_NUM_ARGS(), "rs",
1411+
&im, &field_name, &field_name_len) == FAILURE) {
1412+
RETURN_LONG(-1);
1413+
}
1414+
1415+
if ((image = (VipsImage *)zend_fetch_resource(Z_RES_P(im),
1416+
"GObject", le_gobject)) == NULL) {
1417+
RETURN_LONG(-1);
1418+
}
1419+
1420+
if (!vips_image_remove(image, field_name)) {
1421+
RETURN_LONG(-1);
1422+
}
1423+
1424+
RETURN_LONG(0);
1425+
}
1426+
/* }}} */
1427+
14001428
/* {{{ proto string vips_error_buffer()
14011429
Fetch and clear the vips error buffer */
14021430
PHP_FUNCTION(vips_error_buffer)
@@ -1552,6 +1580,11 @@ ZEND_BEGIN_ARG_INFO(arginfo_vips_image_set, 0)
15521580
ZEND_ARG_INFO(0, value)
15531581
ZEND_END_ARG_INFO()
15541582

1583+
ZEND_BEGIN_ARG_INFO(arginfo_vips_image_remove, 0)
1584+
ZEND_ARG_INFO(0, image)
1585+
ZEND_ARG_INFO(0, field)
1586+
ZEND_END_ARG_INFO()
1587+
15551588
ZEND_BEGIN_ARG_INFO(arginfo_vips_error_buffer, 0)
15561589
ZEND_END_ARG_INFO()
15571590

@@ -1569,6 +1602,7 @@ const zend_function_entry vips_functions[] = {
15691602
PHP_FE(vips_image_get, arginfo_vips_image_get)
15701603
PHP_FE(vips_image_get_typeof, arginfo_vips_image_get_typeof)
15711604
PHP_FE(vips_image_set, arginfo_vips_image_set)
1605+
PHP_FE(vips_image_remove, arginfo_vips_image_remove)
15721606
PHP_FE(vips_error_buffer, arginfo_vips_error_buffer)
15731607

15741608
PHP_FE_END /* Must be the last line in vips_functions[] */

0 commit comments

Comments
 (0)