cvs: php4 /ext/exif exif.c
| From: | Marcus B�rger | Date: | Mon, 18 Mar 2002 00:12:48 +0000 |
| Subject: | cvs: php4 /ext/exif exif.c | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-10309@lists.php.net to get a copy of this message | ||
helly Sun Mar 17 19:12:48 2002 EDT
Modified files:
/php4/ext/exif exif.c
Log:
-use php_stream_make_seekable
Index: php4/ext/exif/exif.c
diff -u php4/ext/exif/exif.c:1.67 php4/ext/exif/exif.c:1.68
--- php4/ext/exif/exif.c:1.67 Sun Mar 17 17:50:54 2002
+++ php4/ext/exif/exif.c Sun Mar 17 19:12:47 2002
@@ -17,7 +17,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: exif.c,v 1.67 2002/03/17 22:50:54 wez Exp $ */
+/* $Id: exif.c,v 1.68 2002/03/18 00:12:47 helly Exp $ */
/* ToDos
*
@@ -113,7 +113,7 @@
};
/* }}} */
-#define EXIF_VERSION "1.3 $Id: exif.c,v 1.67 2002/03/17 22:50:54 wez Exp $"
+#define EXIF_VERSION "1.3 $Id: exif.c,v 1.68 2002/03/18 00:12:47 helly Exp $"
PHP_MINFO_FUNCTION(exif);
@@ -2974,24 +2974,30 @@
ImageInfo->read_all = read_all;
ImageInfo->Thumbnail.filetype = IMAGE_FILETYPE_UNKNOWN;
- /* Store file date/time. */
- if (VCWD_STAT(FileName, &st) >= 0) {
- ImageInfo->FileDateTime = st.st_mtime;
- ImageInfo->FileSize = st.st_size;
+ #ifdef HAVE_PHP_STREAM
+ if ( php_stream_is(ImageInfo->infile, PHP_STREAM_IS_STDIO)) {
+ #endif
+ if (VCWD_STAT(FileName, &st) >= 0) {
+ /* Store file date/time. */
+ ImageInfo->FileDateTime = st.st_mtime;
+ ImageInfo->FileSize = st.st_size;
+ }
+ #ifdef HAVE_PHP_STREAM
} else {
- ImageInfo->FileDateTime = 0;
- #ifdef HAVE_PHP_STREAM
- if ( !php_stream_is(ImageInfo->infile, PHP_STREAM_IS_STDIO)) {
- mem_stream = php_memory_stream_create();
-/* mem_stream = php_stream_fopen_tmpfile(); files my be big */
- ImageInfo->FileSize = php_stream_copy_to_stream(ImageInfo->infile, mem_stream,
PHP_STREAM_COPY_ALL);
- auto_fclose(ImageInfo->infile);
- ImageInfo->infile = mem_stream;
+/*
+ mem_stream = php_stream_temp_create(TEMP_STREAM_DEFAULT,20000000);
+ ImageInfo->FileSize = php_stream_copy_to_stream(ImageInfo->infile, mem_stream,
PHP_STREAM_COPY_ALL);
+ auto_fclose(ImageInfo->infile);
+*/
+ php_stream_make_seekable( ImageInfo->infile, &mem_stream);
+ if ( !ImageInfo->FileSize) {
+ php_stream_seek(mem_stream,0,SEEK_END);
+ ImageInfo->FileSize = php_stream_tell(mem_stream);
+ php_stream_seek(mem_stream,0,SEEK_SET);
}
- #else
- ImageInfo->FileSize = 0;
- #endif
+ ImageInfo->infile = mem_stream;
}
+ #endif
/* Scan the JPEG headers. */
ret = exif_scan_FILE_header(ImageInfo);