Skip to content

Commit 0d3832c

Browse files
author
foobar
committed
Added an optional 2nd parameter 'readall' to read_exif_data.
1 parent dd6a1f9 commit 0d3832c

File tree

1 file changed

+14
-7
lines changed

1 file changed

+14
-7
lines changed

ext/exif/exif.c

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1095,24 +1095,31 @@ int php_read_jpeg_exif(ImageInfoType *ImageInfo, char *FileName, int ReadAll)
10951095
}
10961096
/* }}} */
10971097

1098-
/* {{{ proto string read_exif_data(string filename)
1098+
/* {{{ proto string read_exif_data(string filename [, int readall])
10991099
Reads the EXIF header data from a JPEG file */
1100-
PHP_FUNCTION(read_exif_data) {
1101-
pval **p_name;
1102-
int ac = ZEND_NUM_ARGS(), ret;
1100+
PHP_FUNCTION(read_exif_data)
1101+
{
1102+
pval **p_name, **p_readall;
1103+
int ac = ZEND_NUM_ARGS(), ret, readall=1;
11031104
ImageInfoType ImageInfo;
11041105
char tmp[64];
11051106

11061107
/*ImageInfo.Thumbnail = NULL;
11071108
ImageInfo.ThumbnailSize = 0;
11081109
*/
11091110

1110-
if (ac != 1 || zend_get_parameters_ex(ac, &p_name) == FAILURE)
1111+
if ((ac < 1 || ac > 2) || zend_get_parameters_ex(ac, &p_name, &p_readall) == FAILURE) {
11111112
WRONG_PARAM_COUNT;
1112-
1113+
}
1114+
11131115
convert_to_string_ex(p_name);
11141116

1115-
ret = php_read_jpeg_exif(&ImageInfo, Z_STRVAL_PP(p_name),1);
1117+
if(ac == 2) {
1118+
convert_to_long_ex(p_readall);
1119+
readall = Z_LVAL_PP(p_readall);
1120+
}
1121+
1122+
ret = php_read_jpeg_exif(&ImageInfo, Z_STRVAL_PP(p_name), readall);
11161123

11171124
if (array_init(return_value) == FAILURE) {
11181125
RETURN_FALSE;

0 commit comments

Comments
 (0)