summaryrefslogtreecommitdiff
path: root/ext/exif
diff options
context:
space:
mode:
authorWez Furlong <wez@php.net>2002-03-15 21:03:08 +0000
committerWez Furlong <wez@php.net>2002-03-15 21:03:08 +0000
commit0f65280cb5118d8c1a85db6626f7be365f3d1b26 (patch)
tree931b09acc5041eb771017e3ebf9ecb9aa833d722 /ext/exif
parent3a1ebd4f519facbd7ec769304857aad40e49cf1c (diff)
downloadphp-git-0f65280cb5118d8c1a85db6626f7be365f3d1b26.tar.gz
New PHP streams...
Diffstat (limited to 'ext/exif')
-rw-r--r--ext/exif/exif.c26
1 files changed, 7 insertions, 19 deletions
diff --git a/ext/exif/exif.c b/ext/exif/exif.c
index bce7512862..0b10231bea 100644
--- a/ext/exif/exif.c
+++ b/ext/exif/exif.c
@@ -3220,8 +3220,8 @@ PHP_FUNCTION(exif_thumbnail)
PHP_FUNCTION(exif_imagetype)
{
zval **arg1;
- FILE *fp;
- int issock=0, socketd=0, rsrc_id;
+ php_stream * stream;
+ int rsrc_id;
int itype = 0;
if (ZEND_NUM_ARGS() != 1)
@@ -3230,27 +3230,15 @@ PHP_FUNCTION(exif_imagetype)
if (zend_get_parameters_ex(1, &arg1) == FAILURE)
WRONG_PARAM_COUNT;
- fp = php_fopen_wrapper(Z_STRVAL_PP(arg1), "rb", IGNORE_PATH|ENFORCE_SAFE_MODE, &issock, &socketd, NULL TSRMLS_CC);
+ stream = php_stream_open_wrapper(Z_STRVAL_PP(arg1), "rb", IGNORE_PATH|ENFORCE_SAFE_MODE|REPORT_ERRORS, NULL TSRMLS_CC);
- if (!fp && !socketd) {
- if (issock != BAD_URL) {
- char *tmp = estrndup(Z_STRVAL_PP(arg1), Z_STRLEN_PP(arg1));
- php_strip_url_passwd(tmp);
- php_error(E_WARNING, "getimagetype: Unable to open '%s' for reading.", tmp);
- efree(tmp);
- }
+ if (stream == NULL) {
RETURN_FALSE;
}
- if (issock) {
- int *sock=emalloc(sizeof(int));
- *sock = socketd;
- rsrc_id = ZEND_REGISTER_RESOURCE(NULL, sock, php_file_le_socket());
- } else {
- rsrc_id = ZEND_REGISTER_RESOURCE(NULL, fp, php_file_le_fopen());
- }
+ rsrc_id = ZEND_REGISTER_RESOURCE(NULL, stream, php_file_le_stream());
- itype = itype = php_getimagetype(socketd, fp, issock, NULL);
+ itype = itype = php_getimagetype(stream, NULL);
zend_list_delete(rsrc_id);
@@ -3272,4 +3260,4 @@ PHP_FUNCTION(exif_imagetype)
* vim600: sw=4 ts=4 tw=78 fdm=marker
* vim<600: sw=4 ts=4 tw=78
*/
- \ No newline at end of file
+