}
/* }}} */
-/* {{{ exif_read_from_stream
+/* {{{ exif_read_from_impl
*/
-static int exif_read_from_stream(image_info_type *ImageInfo, php_stream *stream, int read_thumbnail, int read_all)
+static int exif_read_from_impl(image_info_type *ImageInfo, php_stream *stream, int read_thumbnail, int read_all)
{
int ret;
zend_stat_t st;
}
/* }}} */
+/* {{{ exif_read_from_stream
+ */
+static int exif_read_from_stream(image_info_type *ImageInfo, php_stream *stream, int read_thumbnail, int read_all)
+{
+ int ret;
+ off_t old_pos = php_stream_tell(stream);
+
+ if (old_pos) {
+ php_stream_seek(stream, 0, SEEK_SET);
+ }
+
+ ret = exif_read_from_impl(ImageInfo, stream, read_thumbnail, read_all);
+
+ if (old_pos) {
+ php_stream_seek(stream, old_pos, SEEK_SET);
+ }
+
+ return ret;
+}
+/* }}} */
+
/* {{{ exif_read_from_file
*/
static int exif_read_from_file(image_info_type *ImageInfo, char *FileName, int read_thumbnail, int read_all)
--- /dev/null
+--TEST--
+exif_read_data() with streams test
+--SKIPIF--
+<?php if (!extension_loaded('exif')) print 'skip exif extension not available';?>
+--INI--
+output_handler=
+zlib.output_compression=0
+--FILE--
+<?php
+$fp = fopen(__DIR__ . '/image027.tiff', 'rb');
+
+fseek($fp, 100, SEEK_SET);
+
+exif_read_data($fp);
+
+var_dump(ftell($fp) === 100);
+
+fclose($fp);
+?>
+--EXPECT--
+bool(true)