diff options
Diffstat (limited to 'ext/exif')
78 files changed, 21126 insertions, 0 deletions
diff --git a/ext/exif/CREDITS b/ext/exif/CREDITS new file mode 100644 index 0000000..94de97e --- /dev/null +++ b/ext/exif/CREDITS @@ -0,0 +1,2 @@ +EXIF +Rasmus Lerdorf, Marcus Boerger diff --git a/ext/exif/config.m4 b/ext/exif/config.m4 new file mode 100644 index 0000000..a3ba924 --- /dev/null +++ b/ext/exif/config.m4 @@ -0,0 +1,11 @@ +dnl +dnl $Id$ +dnl + +PHP_ARG_ENABLE(exif, whether to enable EXIF (metadata from images) support, +[ --enable-exif Enable EXIF (metadata from images) support]) + +if test "$PHP_EXIF" != "no"; then + AC_DEFINE(HAVE_EXIF, 1, [Whether you want EXIF (metadata from images) support]) + PHP_NEW_EXTENSION(exif, exif.c, $ext_shared) +fi diff --git a/ext/exif/config.w32 b/ext/exif/config.w32 new file mode 100644 index 0000000..38466c8 --- /dev/null +++ b/ext/exif/config.w32 @@ -0,0 +1,14 @@ +// $Id$ +// vim:ft=javascript + +ARG_ENABLE("exif", "exif", "no"); + +if (PHP_EXIF == "yes") { + if (ADD_EXTENSION_DEP('exif', 'mbstring')) { + EXTENSION("exif", "exif.c"); + AC_DEFINE('HAVE_EXIF', 1, 'Have exif'); + } else { + WARNING("exif support can't be enabled, libxml is not enabled") + PHP_EXIF = "no" + } +} diff --git a/ext/exif/example.php b/ext/exif/example.php new file mode 100644 index 0000000..e34dc05 --- /dev/null +++ b/ext/exif/example.php @@ -0,0 +1,23 @@ +<?php +// (c) M.Boerger +// +// $Id$ +// +?><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional"> +<html> +<head> +<title>exif_read_data example</title> +</head> +<body> +<?php +$exif = exif_read_data ('tests/test1.jpg','IFD0'); +echo $exif===false ? "No header data found.<br>\n" : "Image contains headers<br>"; +$exif = exif_read_data ('tests/test2.jpg',0,true); +foreach($exif as $key=>$section) { + foreach($section as $name=>$val) { + echo "$key.$name: $val<br>\n"; + } +} +?> +</body> +</html>
\ No newline at end of file diff --git a/ext/exif/exif.c b/ext/exif/exif.c new file mode 100644 index 0000000..c691075 --- /dev/null +++ b/ext/exif/exif.c @@ -0,0 +1,4195 @@ +/* + +----------------------------------------------------------------------+ + | PHP Version 5 | + +----------------------------------------------------------------------+ + | Copyright (c) 1997-2013 The PHP Group | + +----------------------------------------------------------------------+ + | This source file is subject to version 3.01 of the PHP license, | + | that is bundled with this package in the file LICENSE, and is | + | available through the world-wide-web at the following url: | + | http://www.php.net/license/3_01.txt | + | If you did not receive a copy of the PHP license and are unable to | + | obtain it through the world-wide-web, please send a note to | + | license@php.net so we can mail you a copy immediately. | + +----------------------------------------------------------------------+ + | Authors: Rasmus Lerdorf <rasmus@php.net> | + | Marcus Boerger <helly@php.net> | + +----------------------------------------------------------------------+ + */ + +/* $Id$ */ + +/* ToDos + * + * See if example images from http://www.exif.org have illegal + * thumbnail sizes or if code is corrupt. + * Create/Update exif headers. + * Create/Remove/Update image thumbnails. + */ + +/* Security + * + * At current time i do not see any security problems but a potential + * attacker could generate an image with recursive ifd pointers...(Marcus) + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include "php.h" +#include "ext/standard/file.h" + +#ifdef HAVE_STDINT_H +# include <stdint.h> +#endif +#ifdef HAVE_INTTYPES_H +# include <inttypes.h> +#endif +#ifdef PHP_WIN32 +# include "win32/php_stdint.h" +#endif + +#if HAVE_EXIF + +/* When EXIF_DEBUG is defined the module generates a lot of debug messages + * that help understanding what is going on. This can and should be used + * while extending the module as it shows if you are at the right position. + * You are always considered to have a copy of TIFF6.0 and EXIF2.10 standard. + */ +#undef EXIF_DEBUG + +#ifdef EXIF_DEBUG +#define EXIFERR_DC , const char *_file, size_t _line TSRMLS_DC +#define EXIFERR_CC , __FILE__, __LINE__ TSRMLS_CC +#else +#define EXIFERR_DC TSRMLS_DC +#define EXIFERR_CC TSRMLS_CC +#endif + +#undef EXIF_JPEG2000 + +#include "php_exif.h" +#include <math.h> +#include "php_ini.h" +#include "ext/standard/php_string.h" +#include "ext/standard/php_image.h" +#include "ext/standard/info.h" + +/* needed for ssize_t definition */ +#include <sys/types.h> + +typedef unsigned char uchar; + +#ifndef safe_emalloc +# define safe_emalloc(a,b,c) emalloc((a)*(b)+(c)) +#endif +#ifndef safe_erealloc +# define safe_erealloc(p,a,b,c) erealloc(p, (a)*(b)+(c)) +#endif + +#ifndef TRUE +# define TRUE 1 +# define FALSE 0 +#endif + +#ifndef max +# define max(a,b) ((a)>(b) ? (a) : (b)) +#endif + +#define EFREE_IF(ptr) if (ptr) efree(ptr) + +#define MAX_IFD_NESTING_LEVEL 100 + +/* {{{ arginfo */ +ZEND_BEGIN_ARG_INFO(arginfo_exif_tagname, 0) + ZEND_ARG_INFO(0, index) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_INFO_EX(arginfo_exif_read_data, 0, 0, 1) + ZEND_ARG_INFO(0, filename) + ZEND_ARG_INFO(0, sections_needed) + ZEND_ARG_INFO(0, sub_arrays) + ZEND_ARG_INFO(0, read_thumbnail) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_INFO_EX(arginfo_exif_thumbnail, 0, 0, 1) + ZEND_ARG_INFO(0, filename) + ZEND_ARG_INFO(1, width) + ZEND_ARG_INFO(1, height) + ZEND_ARG_INFO(1, imagetype) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_INFO(arginfo_exif_imagetype, 0) + ZEND_ARG_INFO(0, imagefile) +ZEND_END_ARG_INFO() + +/* }}} */ + +/* {{{ exif_functions[] + */ +const zend_function_entry exif_functions[] = { + PHP_FE(exif_read_data, arginfo_exif_read_data) + PHP_FALIAS(read_exif_data, exif_read_data, arginfo_exif_read_data) + PHP_FE(exif_tagname, arginfo_exif_tagname) + PHP_FE(exif_thumbnail, arginfo_exif_thumbnail) + PHP_FE(exif_imagetype, arginfo_exif_imagetype) + PHP_FE_END +}; +/* }}} */ + +#define EXIF_VERSION "1.4 $Id$" + +/* {{{ PHP_MINFO_FUNCTION + */ +PHP_MINFO_FUNCTION(exif) +{ + php_info_print_table_start(); + php_info_print_table_row(2, "EXIF Support", "enabled"); + php_info_print_table_row(2, "EXIF Version", EXIF_VERSION); + php_info_print_table_row(2, "Supported EXIF Version", "0220"); + php_info_print_table_row(2, "Supported filetypes", "JPEG,TIFF"); + php_info_print_table_end(); + DISPLAY_INI_ENTRIES(); +} +/* }}} */ + +ZEND_BEGIN_MODULE_GLOBALS(exif) + char * encode_unicode; + char * decode_unicode_be; + char * decode_unicode_le; + char * encode_jis; + char * decode_jis_be; + char * decode_jis_le; +ZEND_END_MODULE_GLOBALS(exif) + +ZEND_DECLARE_MODULE_GLOBALS(exif) + +#ifdef ZTS +#define EXIF_G(v) TSRMG(exif_globals_id, zend_exif_globals *, v) +#else +#define EXIF_G(v) (exif_globals.v) +#endif + +/* {{{ PHP_INI + */ + +ZEND_INI_MH(OnUpdateEncode) +{ + if (new_value && new_value_length) { + const zend_encoding **return_list; + size_t return_size; + if (FAILURE == zend_multibyte_parse_encoding_list(new_value, new_value_length, + &return_list, &return_size, 0 TSRMLS_CC)) { + php_error_docref(NULL TSRMLS_CC, E_WARNING, "Illegal encoding ignored: '%s'", new_value); + return FAILURE; + } + efree(return_list); + } + return OnUpdateString(entry, new_value, new_value_length, mh_arg1, mh_arg2, mh_arg3, stage TSRMLS_CC); +} + +ZEND_INI_MH(OnUpdateDecode) +{ + if (new_value) { + const zend_encoding **return_list; + size_t return_size; + if (FAILURE == zend_multibyte_parse_encoding_list(new_value, new_value_length, + &return_list, &return_size, 0 TSRMLS_CC)) { + php_error_docref(NULL TSRMLS_CC, E_WARNING, "Illegal encoding ignored: '%s'", new_value); + return FAILURE; + } + efree(return_list); + } + return OnUpdateString(entry, new_value, new_value_length, mh_arg1, mh_arg2, mh_arg3, stage TSRMLS_CC); +} + +PHP_INI_BEGIN() + STD_PHP_INI_ENTRY("exif.encode_unicode", "ISO-8859-15", PHP_INI_ALL, OnUpdateEncode, encode_unicode, zend_exif_globals, exif_globals) + STD_PHP_INI_ENTRY("exif.decode_unicode_motorola", "UCS-2BE", PHP_INI_ALL, OnUpdateDecode, decode_unicode_be, zend_exif_globals, exif_globals) + STD_PHP_INI_ENTRY("exif.decode_unicode_intel", "UCS-2LE", PHP_INI_ALL, OnUpdateDecode, decode_unicode_le, zend_exif_globals, exif_globals) + STD_PHP_INI_ENTRY("exif.encode_jis", "", PHP_INI_ALL, OnUpdateEncode, encode_jis, zend_exif_globals, exif_globals) + STD_PHP_INI_ENTRY("exif.decode_jis_motorola", "JIS", PHP_INI_ALL, OnUpdateDecode, decode_jis_be, zend_exif_globals, exif_globals) + STD_PHP_INI_ENTRY("exif.decode_jis_intel", "JIS", PHP_INI_ALL, OnUpdateDecode, decode_jis_le, zend_exif_globals, exif_globals) +PHP_INI_END() +/* }}} */ + +/* {{{ PHP_GINIT_FUNCTION + */ +static PHP_GINIT_FUNCTION(exif) +{ + exif_globals->encode_unicode = NULL; + exif_globals->decode_unicode_be = NULL; + exif_globals->decode_unicode_le = NULL; + exif_globals->encode_jis = NULL; + exif_globals->decode_jis_be = NULL; + exif_globals->decode_jis_le = NULL; +} +/* }}} */ + +/* {{{ PHP_MINIT_FUNCTION(exif) + Get the size of an image as 4-element array */ +PHP_MINIT_FUNCTION(exif) +{ + REGISTER_INI_ENTRIES(); + if (zend_hash_exists(&module_registry, "mbstring", sizeof("mbstring"))) { + REGISTER_LONG_CONSTANT("EXIF_USE_MBSTRING", 1, CONST_CS | CONST_PERSISTENT); + } else { + REGISTER_LONG_CONSTANT("EXIF_USE_MBSTRING", 0, CONST_CS | CONST_PERSISTENT); + } + return SUCCESS; +} +/* }}} */ + +/* {{{ PHP_MSHUTDOWN_FUNCTION + */ +PHP_MSHUTDOWN_FUNCTION(exif) +{ + UNREGISTER_INI_ENTRIES(); + return SUCCESS; +} +/* }}} */ + +/* {{{ exif dependencies */ +static const zend_module_dep exif_module_deps[] = { + ZEND_MOD_REQUIRED("standard") + ZEND_MOD_OPTIONAL("mbstring") + ZEND_MOD_END +}; +/* }}} */ + +/* {{{ exif_module_entry + */ +zend_module_entry exif_module_entry = { + STANDARD_MODULE_HEADER_EX, NULL, + exif_module_deps, + "exif", + exif_functions, + PHP_MINIT(exif), + PHP_MSHUTDOWN(exif), + NULL, NULL, + PHP_MINFO(exif), +#if ZEND_MODULE_API_NO >= 20010901 + EXIF_VERSION, +#endif +#if ZEND_MODULE_API_NO >= 20060613 + PHP_MODULE_GLOBALS(exif), + PHP_GINIT(exif), + NULL, + NULL, + STANDARD_MODULE_PROPERTIES_EX +#else + STANDARD_MODULE_PROPERTIES +#endif +}; +/* }}} */ + +#ifdef COMPILE_DL_EXIF +ZEND_GET_MODULE(exif) +#endif + +/* {{{ php_strnlen + * get length of string if buffer if less than buffer size or buffer size */ +static size_t php_strnlen(char* str, size_t maxlen) { + size_t len = 0; + + if (str && maxlen && *str) { + do { + len++; + } while (--maxlen && *(++str)); + } + return len; +} +/* }}} */ + +/* {{{ error messages +*/ +static const char * EXIF_ERROR_FILEEOF = "Unexpected end of file reached"; +static const char * EXIF_ERROR_CORRUPT = "File structure corrupted"; +static const char * EXIF_ERROR_THUMBEOF = "Thumbnail goes IFD boundary or end of file reached"; +static const char * EXIF_ERROR_FSREALLOC = "Illegal reallocating of undefined file section"; + +#define EXIF_ERRLOG_FILEEOF(ImageInfo) exif_error_docref(NULL EXIFERR_CC, ImageInfo, E_WARNING, "%s", EXIF_ERROR_FILEEOF); +#define EXIF_ERRLOG_CORRUPT(ImageInfo) exif_error_docref(NULL EXIFERR_CC, ImageInfo, E_WARNING, "%s", EXIF_ERROR_CORRUPT); +#define EXIF_ERRLOG_THUMBEOF(ImageInfo) exif_error_docref(NULL EXIFERR_CC, ImageInfo, E_WARNING, "%s", EXIF_ERROR_THUMBEOF); +#define EXIF_ERRLOG_FSREALLOC(ImageInfo) exif_error_docref(NULL EXIFERR_CC, ImageInfo, E_WARNING, "%s", EXIF_ERROR_FSREALLOC); +/* }}} */ + +/* {{{ format description defines + Describes format descriptor +*/ +static int php_tiff_bytes_per_format[] = {0, 1, 1, 2, 4, 8, 1, 1, 2, 4, 8, 4, 8, 1}; +#define NUM_FORMATS 13 + +#define TAG_FMT_BYTE 1 +#define TAG_FMT_STRING 2 +#define TAG_FMT_USHORT 3 +#define TAG_FMT_ULONG 4 +#define TAG_FMT_URATIONAL 5 +#define TAG_FMT_SBYTE 6 +#define TAG_FMT_UNDEFINED 7 +#define TAG_FMT_SSHORT 8 +#define TAG_FMT_SLONG 9 +#define TAG_FMT_SRATIONAL 10 +#define TAG_FMT_SINGLE 11 +#define TAG_FMT_DOUBLE 12 +#define TAG_FMT_IFD 13 + +#ifdef EXIF_DEBUG +static char *exif_get_tagformat(int format) +{ + switch(format) { + case TAG_FMT_BYTE: return "BYTE"; + case TAG_FMT_STRING: return "STRING"; + case TAG_FMT_USHORT: return "USHORT"; + case TAG_FMT_ULONG: return "ULONG"; + case TAG_FMT_URATIONAL: return "URATIONAL"; + case TAG_FMT_SBYTE: return "SBYTE"; + case TAG_FMT_UNDEFINED: return "UNDEFINED"; + case TAG_FMT_SSHORT: return "SSHORT"; + case TAG_FMT_SLONG: return "SLONG"; + case TAG_FMT_SRATIONAL: return "SRATIONAL"; + case TAG_FMT_SINGLE: return "SINGLE"; + case TAG_FMT_DOUBLE: return "DOUBLE"; + case TAG_FMT_IFD: return "IFD"; + } + return "*Illegal"; +} +#endif + +/* Describes tag values */ +#define TAG_GPS_VERSION_ID 0x0000 +#define TAG_GPS_LATITUDE_REF 0x0001 +#define TAG_GPS_LATITUDE 0x0002 +#define TAG_GPS_LONGITUDE_REF 0x0003 +#define TAG_GPS_LONGITUDE 0x0004 +#define TAG_GPS_ALTITUDE_REF 0x0005 +#define TAG_GPS_ALTITUDE 0x0006 +#define TAG_GPS_TIME_STAMP 0x0007 +#define TAG_GPS_SATELLITES 0x0008 +#define TAG_GPS_STATUS 0x0009 +#define TAG_GPS_MEASURE_MODE 0x000A +#define TAG_GPS_DOP 0x000B +#define TAG_GPS_SPEED_REF 0x000C +#define TAG_GPS_SPEED 0x000D +#define TAG_GPS_TRACK_REF 0x000E +#define TAG_GPS_TRACK 0x000F +#define TAG_GPS_IMG_DIRECTION_REF 0x0010 +#define TAG_GPS_IMG_DIRECTION 0x0011 +#define TAG_GPS_MAP_DATUM 0x0012 +#define TAG_GPS_DEST_LATITUDE_REF 0x0013 +#define TAG_GPS_DEST_LATITUDE 0x0014 +#define TAG_GPS_DEST_LONGITUDE_REF 0x0015 +#define TAG_GPS_DEST_LONGITUDE 0x0016 +#define TAG_GPS_DEST_BEARING_REF 0x0017 +#define TAG_GPS_DEST_BEARING 0x0018 +#define TAG_GPS_DEST_DISTANCE_REF 0x0019 +#define TAG_GPS_DEST_DISTANCE 0x001A +#define TAG_GPS_PROCESSING_METHOD 0x001B +#define TAG_GPS_AREA_INFORMATION 0x001C +#define TAG_GPS_DATE_STAMP 0x001D +#define TAG_GPS_DIFFERENTIAL 0x001E +#define TAG_TIFF_COMMENT 0x00FE /* SHOUDLNT HAPPEN */ +#define TAG_NEW_SUBFILE 0x00FE /* New version of subfile tag */ +#define TAG_SUBFILE_TYPE 0x00FF /* Old version of subfile tag */ +#define TAG_IMAGEWIDTH 0x0100 +#define TAG_IMAGEHEIGHT 0x0101 +#define TAG_BITS_PER_SAMPLE 0x0102 +#define TAG_COMPRESSION 0x0103 +#define TAG_PHOTOMETRIC_INTERPRETATION 0x0106 +#define TAG_TRESHHOLDING 0x0107 +#define TAG_CELL_WIDTH 0x0108 +#define TAG_CELL_HEIGHT 0x0109 +#define TAG_FILL_ORDER 0x010A +#define TAG_DOCUMENT_NAME 0x010D +#define TAG_IMAGE_DESCRIPTION 0x010E +#define TAG_MAKE 0x010F +#define TAG_MODEL 0x0110 +#define TAG_STRIP_OFFSETS 0x0111 +#define TAG_ORIENTATION 0x0112 +#define TAG_SAMPLES_PER_PIXEL 0x0115 +#define TAG_ROWS_PER_STRIP 0x0116 +#define TAG_STRIP_BYTE_COUNTS 0x0117 +#define TAG_MIN_SAMPPLE_VALUE 0x0118 +#define TAG_MAX_SAMPLE_VALUE 0x0119 +#define TAG_X_RESOLUTION 0x011A +#define TAG_Y_RESOLUTION 0x011B +#define TAG_PLANAR_CONFIGURATION 0x011C +#define TAG_PAGE_NAME 0x011D +#define TAG_X_POSITION 0x011E +#define TAG_Y_POSITION 0x011F +#define TAG_FREE_OFFSETS 0x0120 +#define TAG_FREE_BYTE_COUNTS 0x0121 +#define TAG_GRAY_RESPONSE_UNIT 0x0122 +#define TAG_GRAY_RESPONSE_CURVE 0x0123 +#define TAG_RESOLUTION_UNIT 0x0128 +#define TAG_PAGE_NUMBER 0x0129 +#define TAG_TRANSFER_FUNCTION 0x012D +#define TAG_SOFTWARE 0x0131 +#define TAG_DATETIME 0x0132 +#define TAG_ARTIST 0x013B +#define TAG_HOST_COMPUTER 0x013C +#define TAG_PREDICTOR 0x013D +#define TAG_WHITE_POINT 0x013E +#define TAG_PRIMARY_CHROMATICITIES 0x013F +#define TAG_COLOR_MAP 0x0140 +#define TAG_HALFTONE_HINTS 0x0141 +#define TAG_TILE_WIDTH 0x0142 +#define TAG_TILE_LENGTH 0x0143 +#define TAG_TILE_OFFSETS 0x0144 +#define TAG_TILE_BYTE_COUNTS 0x0145 +#define TAG_SUB_IFD 0x014A +#define TAG_INK_SETMPUTER 0x014C +#define TAG_INK_NAMES 0x014D +#define TAG_NUMBER_OF_INKS 0x014E +#define TAG_DOT_RANGE 0x0150 +#define TAG_TARGET_PRINTER 0x0151 +#define TAG_EXTRA_SAMPLE 0x0152 +#define TAG_SAMPLE_FORMAT 0x0153 +#define TAG_S_MIN_SAMPLE_VALUE 0x0154 +#define TAG_S_MAX_SAMPLE_VALUE 0x0155 +#define TAG_TRANSFER_RANGE 0x0156 +#define TAG_JPEG_TABLES 0x015B +#define TAG_JPEG_PROC 0x0200 +#define TAG_JPEG_INTERCHANGE_FORMAT 0x0201 +#define TAG_JPEG_INTERCHANGE_FORMAT_LEN 0x0202 +#define TAG_JPEG_RESTART_INTERVAL 0x0203 +#define TAG_JPEG_LOSSLESS_PREDICTOR 0x0205 +#define TAG_JPEG_POINT_TRANSFORMS 0x0206 +#define TAG_JPEG_Q_TABLES 0x0207 +#define TAG_JPEG_DC_TABLES 0x0208 +#define TAG_JPEG_AC_TABLES 0x0209 +#define TAG_YCC_COEFFICIENTS 0x0211 +#define TAG_YCC_SUB_SAMPLING 0x0212 +#define TAG_YCC_POSITIONING 0x0213 +#define TAG_REFERENCE_BLACK_WHITE 0x0214 +/* 0x0301 - 0x0302 */ +/* 0x0320 */ +/* 0x0343 */ +/* 0x5001 - 0x501B */ +/* 0x5021 - 0x503B */ +/* 0x5090 - 0x5091 */ +/* 0x5100 - 0x5101 */ +/* 0x5110 - 0x5113 */ +/* 0x80E3 - 0x80E6 */ +/* 0x828d - 0x828F */ +#define TAG_COPYRIGHT 0x8298 +#define TAG_EXPOSURETIME 0x829A +#define TAG_FNUMBER 0x829D +#define TAG_EXIF_IFD_POINTER 0x8769 +#define TAG_ICC_PROFILE 0x8773 +#define TAG_EXPOSURE_PROGRAM 0x8822 +#define TAG_SPECTRAL_SENSITY 0x8824 +#define TAG_GPS_IFD_POINTER 0x8825 +#define TAG_ISOSPEED 0x8827 +#define TAG_OPTOELECTRIC_CONVERSION_F 0x8828 +/* 0x8829 - 0x882b */ +#define TAG_EXIFVERSION 0x9000 +#define TAG_DATE_TIME_ORIGINAL 0x9003 +#define TAG_DATE_TIME_DIGITIZED 0x9004 +#define TAG_COMPONENT_CONFIG 0x9101 +#define TAG_COMPRESSED_BITS_PER_PIXEL 0x9102 +#define TAG_SHUTTERSPEED 0x9201 +#define TAG_APERTURE 0x9202 +#define TAG_BRIGHTNESS_VALUE 0x9203 +#define TAG_EXPOSURE_BIAS_VALUE 0x9204 +#define TAG_MAX_APERTURE 0x9205 +#define TAG_SUBJECT_DISTANCE 0x9206 +#define TAG_METRIC_MODULE 0x9207 +#define TAG_LIGHT_SOURCE 0x9208 +#define TAG_FLASH 0x9209 +#define TAG_FOCAL_LENGTH 0x920A +/* 0x920B - 0x920D */ +/* 0x9211 - 0x9216 */ +#define TAG_SUBJECT_AREA 0x9214 +#define TAG_MAKER_NOTE 0x927C +#define TAG_USERCOMMENT 0x9286 +#define TAG_SUB_SEC_TIME 0x9290 +#define TAG_SUB_SEC_TIME_ORIGINAL 0x9291 +#define TAG_SUB_SEC_TIME_DIGITIZED 0x9292 +/* 0x923F */ +/* 0x935C */ +#define TAG_XP_TITLE 0x9C9B +#define TAG_XP_COMMENTS 0x9C9C +#define TAG_XP_AUTHOR 0x9C9D +#define TAG_XP_KEYWORDS 0x9C9E +#define TAG_XP_SUBJECT 0x9C9F +#define TAG_FLASH_PIX_VERSION 0xA000 +#define TAG_COLOR_SPACE 0xA001 +#define TAG_COMP_IMAGE_WIDTH 0xA002 /* compressed images only */ +#define TAG_COMP_IMAGE_HEIGHT 0xA003 +#define TAG_RELATED_SOUND_FILE 0xA004 +#define TAG_INTEROP_IFD_POINTER 0xA005 /* IFD pointer */ +#define TAG_FLASH_ENERGY 0xA20B +#define TAG_SPATIAL_FREQUENCY_RESPONSE 0xA20C +#define TAG_FOCALPLANE_X_RES 0xA20E +#define TAG_FOCALPLANE_Y_RES 0xA20F +#define TAG_FOCALPLANE_RESOLUTION_UNIT 0xA210 +#define TAG_SUBJECT_LOCATION 0xA214 +#define TAG_EXPOSURE_INDEX 0xA215 +#define TAG_SENSING_METHOD 0xA217 +#define TAG_FILE_SOURCE 0xA300 +#define TAG_SCENE_TYPE 0xA301 +#define TAG_CFA_PATTERN 0xA302 +#define TAG_CUSTOM_RENDERED 0xA401 +#define TAG_EXPOSURE_MODE 0xA402 +#define TAG_WHITE_BALANCE 0xA403 +#define TAG_DIGITAL_ZOOM_RATIO 0xA404 +#define TAG_FOCAL_LENGTH_IN_35_MM_FILM 0xA405 +#define TAG_SCENE_CAPTURE_TYPE 0xA406 +#define TAG_GAIN_CONTROL 0xA407 +#define TAG_CONTRAST 0xA408 +#define TAG_SATURATION 0xA409 +#define TAG_SHARPNESS 0xA40A +#define TAG_DEVICE_SETTING_DESCRIPTION 0xA40B +#define TAG_SUBJECT_DISTANCE_RANGE 0xA40C +#define TAG_IMAGE_UNIQUE_ID 0xA420 + +/* Olympus specific tags */ +#define TAG_OLYMPUS_SPECIALMODE 0x0200 +#define TAG_OLYMPUS_JPEGQUAL 0x0201 +#define TAG_OLYMPUS_MACRO 0x0202 +#define TAG_OLYMPUS_DIGIZOOM 0x0204 +#define TAG_OLYMPUS_SOFTWARERELEASE 0x0207 +#define TAG_OLYMPUS_PICTINFO 0x0208 +#define TAG_OLYMPUS_CAMERAID 0x0209 +/* end Olympus specific tags */ + +/* Internal */ +#define TAG_NONE -1 /* note that -1 <> 0xFFFF */ +#define TAG_COMPUTED_VALUE -2 +#define TAG_END_OF_LIST 0xFFFD + +/* Values for TAG_PHOTOMETRIC_INTERPRETATION */ +#define PMI_BLACK_IS_ZERO 0 +#define PMI_WHITE_IS_ZERO 1 +#define PMI_RGB 2 +#define PMI_PALETTE_COLOR 3 +#define PMI_TRANSPARENCY_MASK 4 +#define PMI_SEPARATED 5 +#define PMI_YCBCR 6 +#define PMI_CIELAB 8 + +/* }}} */ + +/* {{{ TabTable[] + */ +typedef const struct { + unsigned short Tag; + char *Desc; +} tag_info_type; + +typedef tag_info_type tag_info_array[]; +typedef tag_info_type *tag_table_type; + +#define TAG_TABLE_END \ + {TAG_NONE, "No tag value"},\ + {TAG_COMPUTED_VALUE, "Computed value"},\ + {TAG_END_OF_LIST, ""} /* Important for exif_get_tagname() IF value != "" function result is != false */ + +static tag_info_array tag_table_IFD = { + { 0x000B, "ACDComment"}, + { 0x00FE, "NewSubFile"}, /* better name it 'ImageType' ? */ + { 0x00FF, "SubFile"}, + { 0x0100, "ImageWidth"}, + { 0x0101, "ImageLength"}, + { 0x0102, "BitsPerSample"}, + { 0x0103, "Compression"}, + { 0x0106, "PhotometricInterpretation"}, + { 0x010A, "FillOrder"}, + { 0x010D, "DocumentName"}, + { 0x010E, "ImageDescription"}, + { 0x010F, "Make"}, + { 0x0110, "Model"}, + { 0x0111, "StripOffsets"}, + { 0x0112, "Orientation"}, + { 0x0115, "SamplesPerPixel"}, + { 0x0116, "RowsPerStrip"}, + { 0x0117, "StripByteCounts"}, + { 0x0118, "MinSampleValue"}, + { 0x0119, "MaxSampleValue"}, + { 0x011A, "XResolution"}, + { 0x011B, "YResolution"}, + { 0x011C, "PlanarConfiguration"}, + { 0x011D, "PageName"}, + { 0x011E, "XPosition"}, + { 0x011F, "YPosition"}, + { 0x0120, "FreeOffsets"}, + { 0x0121, "FreeByteCounts"}, + { 0x0122, "GrayResponseUnit"}, + { 0x0123, "GrayResponseCurve"}, + { 0x0124, "T4Options"}, + { 0x0125, "T6Options"}, + { 0x0128, "ResolutionUnit"}, + { 0x0129, "PageNumber"}, + { 0x012D, "TransferFunction"}, + { 0x0131, "Software"}, + { 0x0132, "DateTime"}, + { 0x013B, "Artist"}, + { 0x013C, "HostComputer"}, + { 0x013D, "Predictor"}, + { 0x013E, "WhitePoint"}, + { 0x013F, "PrimaryChromaticities"}, + { 0x0140, "ColorMap"}, + { 0x0141, "HalfToneHints"}, + { 0x0142, "TileWidth"}, + { 0x0143, "TileLength"}, + { 0x0144, "TileOffsets"}, + { 0x0145, "TileByteCounts"}, + { 0x014A, "SubIFD"}, + { 0x014C, "InkSet"}, + { 0x014D, "InkNames"}, + { 0x014E, "NumberOfInks"}, + { 0x0150, "DotRange"}, + { 0x0151, "TargetPrinter"}, + { 0x0152, "ExtraSample"}, + { 0x0153, "SampleFormat"}, + { 0x0154, "SMinSampleValue"}, + { 0x0155, "SMaxSampleValue"}, + { 0x0156, "TransferRange"}, + { 0x0157, "ClipPath"}, + { 0x0158, "XClipPathUnits"}, + { 0x0159, "YClipPathUnits"}, + { 0x015A, "Indexed"}, + { 0x015B, "JPEGTables"}, + { 0x015F, "OPIProxy"}, + { 0x0200, "JPEGProc"}, + { 0x0201, "JPEGInterchangeFormat"}, + { 0x0202, "JPEGInterchangeFormatLength"}, + { 0x0203, "JPEGRestartInterval"}, + { 0x0205, "JPEGLosslessPredictors"}, + { 0x0206, "JPEGPointTransforms"}, + { 0x0207, "JPEGQTables"}, + { 0x0208, "JPEGDCTables"}, + { 0x0209, "JPEGACTables"}, + { 0x0211, "YCbCrCoefficients"}, + { 0x0212, "YCbCrSubSampling"}, + { 0x0213, "YCbCrPositioning"}, + { 0x0214, "ReferenceBlackWhite"}, + { 0x02BC, "ExtensibleMetadataPlatform"}, /* XAP: Extensible Authoring Publishing, obsoleted by XMP: Extensible Metadata Platform */ + { 0x0301, "Gamma"}, + { 0x0302, "ICCProfileDescriptor"}, + { 0x0303, "SRGBRenderingIntent"}, + { 0x0320, "ImageTitle"}, + { 0x5001, "ResolutionXUnit"}, + { 0x5002, "ResolutionYUnit"}, + { 0x5003, "ResolutionXLengthUnit"}, + { 0x5004, "ResolutionYLengthUnit"}, + { 0x5005, "PrintFlags"}, + { 0x5006, "PrintFlagsVersion"}, + { 0x5007, "PrintFlagsCrop"}, + { 0x5008, "PrintFlagsBleedWidth"}, + { 0x5009, "PrintFlagsBleedWidthScale"}, + { 0x500A, "HalftoneLPI"}, + { 0x500B, "HalftoneLPIUnit"}, + { 0x500C, "HalftoneDegree"}, + { 0x500D, "HalftoneShape"}, + { 0x500E, "HalftoneMisc"}, + { 0x500F, "HalftoneScreen"}, + { 0x5010, "JPEGQuality"}, + { 0x5011, "GridSize"}, + { 0x5012, "ThumbnailFormat"}, + { 0x5013, "ThumbnailWidth"}, + { 0x5014, "ThumbnailHeight"}, + { 0x5015, "ThumbnailColorDepth"}, + { 0x5016, "ThumbnailPlanes"}, + { 0x5017, "ThumbnailRawBytes"}, + { 0x5018, "ThumbnailSize"}, + { 0x5019, "ThumbnailCompressedSize"}, + { 0x501A, "ColorTransferFunction"}, + { 0x501B, "ThumbnailData"}, + { 0x5020, "ThumbnailImageWidth"}, + { 0x5021, "ThumbnailImageHeight"}, + { 0x5022, "ThumbnailBitsPerSample"}, + { 0x5023, "ThumbnailCompression"}, + { 0x5024, "ThumbnailPhotometricInterp"}, + { 0x5025, "ThumbnailImageDescription"}, + { 0x5026, "ThumbnailEquipMake"}, + { 0x5027, "ThumbnailEquipModel"}, + { 0x5028, "ThumbnailStripOffsets"}, + { 0x5029, "ThumbnailOrientation"}, + { 0x502A, "ThumbnailSamplesPerPixel"}, + { 0x502B, "ThumbnailRowsPerStrip"}, + { 0x502C, "ThumbnailStripBytesCount"}, + { 0x502D, "ThumbnailResolutionX"}, + { 0x502E, "ThumbnailResolutionY"}, + { 0x502F, "ThumbnailPlanarConfig"}, + { 0x5030, "ThumbnailResolutionUnit"}, + { 0x5031, "ThumbnailTransferFunction"}, + { 0x5032, "ThumbnailSoftwareUsed"}, + { 0x5033, "ThumbnailDateTime"}, + { 0x5034, "ThumbnailArtist"}, + { 0x5035, "ThumbnailWhitePoint"}, + { 0x5036, "ThumbnailPrimaryChromaticities"}, + { 0x5037, "ThumbnailYCbCrCoefficients"}, + { 0x5038, "ThumbnailYCbCrSubsampling"}, + { 0x5039, "ThumbnailYCbCrPositioning"}, + { 0x503A, "ThumbnailRefBlackWhite"}, + { 0x503B, "ThumbnailCopyRight"}, + { 0x5090, "LuminanceTable"}, + { 0x5091, "ChrominanceTable"}, + { 0x5100, "FrameDelay"}, + { 0x5101, "LoopCount"}, + { 0x5110, "PixelUnit"}, + { 0x5111, "PixelPerUnitX"}, + { 0x5112, "PixelPerUnitY"}, + { 0x5113, "PaletteHistogram"}, + { 0x1000, "RelatedImageFileFormat"}, + { 0x800D, "ImageID"}, + { 0x80E3, "Matteing"}, /* obsoleted by ExtraSamples */ + { 0x80E4, "DataType"}, /* obsoleted by SampleFormat */ + { 0x80E5, "ImageDepth"}, + { 0x80E6, "TileDepth"}, + { 0x828D, "CFARepeatPatternDim"}, + { 0x828E, "CFAPattern"}, + { 0x828F, "BatteryLevel"}, + { 0x8298, "Copyright"}, + { 0x829A, "ExposureTime"}, + { 0x829D, "FNumber"}, + { 0x83BB, "IPTC/NAA"}, + { 0x84E3, "IT8RasterPadding"}, + { 0x84E5, "IT8ColorTable"}, + { 0x8649, "ImageResourceInformation"}, /* PhotoShop */ + { 0x8769, "Exif_IFD_Pointer"}, + { 0x8773, "ICC_Profile"}, + { 0x8822, "ExposureProgram"}, + { 0x8824, "SpectralSensity"}, + { 0x8828, "OECF"}, + { 0x8825, "GPS_IFD_Pointer"}, + { 0x8827, "ISOSpeedRatings"}, + { 0x8828, "OECF"}, + { 0x9000, "ExifVersion"}, + { 0x9003, "DateTimeOriginal"}, + { 0x9004, "DateTimeDigitized"}, + { 0x9101, "ComponentsConfiguration"}, + { 0x9102, "CompressedBitsPerPixel"}, + { 0x9201, "ShutterSpeedValue"}, + { 0x9202, "ApertureValue"}, + { 0x9203, "BrightnessValue"}, + { 0x9204, "ExposureBiasValue"}, + { 0x9205, "MaxApertureValue"}, + { 0x9206, "SubjectDistance"}, + { 0x9207, "MeteringMode"}, + { 0x9208, "LightSource"}, + { 0x9209, "Flash"}, + { 0x920A, "FocalLength"}, + { 0x920B, "FlashEnergy"}, /* 0xA20B in JPEG */ + { 0x920C, "SpatialFrequencyResponse"}, /* 0xA20C - - */ + { 0x920D, "Noise"}, + { 0x920E, "FocalPlaneXResolution"}, /* 0xA20E - - */ + { 0x920F, "FocalPlaneYResolution"}, /* 0xA20F - - */ + { 0x9210, "FocalPlaneResolutionUnit"}, /* 0xA210 - - */ + { 0x9211, "ImageNumber"}, + { 0x9212, "SecurityClassification"}, + { 0x9213, "ImageHistory"}, + { 0x9214, "SubjectLocation"}, /* 0xA214 - - */ + { 0x9215, "ExposureIndex"}, /* 0xA215 - - */ + { 0x9216, "TIFF/EPStandardID"}, + { 0x9217, "SensingMethod"}, /* 0xA217 - - */ + { 0x923F, "StoNits"}, + { 0x927C, "MakerNote"}, + { 0x9286, "UserComment"}, + { 0x9290, "SubSecTime"}, + { 0x9291, "SubSecTimeOriginal"}, + { 0x9292, "SubSecTimeDigitized"}, + { 0x935C, "ImageSourceData"}, /* "Adobe Photoshop Document Data Block": 8BIM... */ + { 0x9c9b, "Title" }, /* Win XP specific, Unicode */ + { 0x9c9c, "Comments" }, /* Win XP specific, Unicode */ + { 0x9c9d, "Author" }, /* Win XP specific, Unicode */ + { 0x9c9e, "Keywords" }, /* Win XP specific, Unicode */ + { 0x9c9f, "Subject" }, /* Win XP specific, Unicode, not to be confused with SubjectDistance and SubjectLocation */ + { 0xA000, "FlashPixVersion"}, + { 0xA001, "ColorSpace"}, + { 0xA002, "ExifImageWidth"}, + { 0xA003, "ExifImageLength"}, + { 0xA004, "RelatedSoundFile"}, + { 0xA005, "InteroperabilityOffset"}, + { 0xA20B, "FlashEnergy"}, /* 0x920B in TIFF/EP */ + { 0xA20C, "SpatialFrequencyResponse"}, /* 0x920C - - */ + { 0xA20D, "Noise"}, + { 0xA20E, "FocalPlaneXResolution"}, /* 0x920E - - */ + { 0xA20F, "FocalPlaneYResolution"}, /* 0x920F - - */ + { 0xA210, "FocalPlaneResolutionUnit"}, /* 0x9210 - - */ + { 0xA211, "ImageNumber"}, + { 0xA212, "SecurityClassification"}, + { 0xA213, "ImageHistory"}, + { 0xA214, "SubjectLocation"}, /* 0x9214 - - */ + { 0xA215, "ExposureIndex"}, /* 0x9215 - - */ + { 0xA216, "TIFF/EPStandardID"}, + { 0xA217, "SensingMethod"}, /* 0x9217 - - */ + { 0xA300, "FileSource"}, + { 0xA301, "SceneType"}, + { 0xA302, "CFAPattern"}, + { 0xA401, "CustomRendered"}, + { 0xA402, "ExposureMode"}, + { 0xA403, "WhiteBalance"}, + { 0xA404, "DigitalZoomRatio"}, + { 0xA405, "FocalLengthIn35mmFilm"}, + { 0xA406, "SceneCaptureType"}, + { 0xA407, "GainControl"}, + { 0xA408, "Contrast"}, + { 0xA409, "Saturation"}, + { 0xA40A, "Sharpness"}, + { 0xA40B, "DeviceSettingDescription"}, + { 0xA40C, "SubjectDistanceRange"}, + { 0xA420, "ImageUniqueID"}, + TAG_TABLE_END +} ; + +static tag_info_array tag_table_GPS = { + { 0x0000, "GPSVersion"}, + { 0x0001, "GPSLatitudeRef"}, + { 0x0002, "GPSLatitude"}, + { 0x0003, "GPSLongitudeRef"}, + { 0x0004, "GPSLongitude"}, + { 0x0005, "GPSAltitudeRef"}, + { 0x0006, "GPSAltitude"}, + { 0x0007, "GPSTimeStamp"}, + { 0x0008, "GPSSatellites"}, + { 0x0009, "GPSStatus"}, + { 0x000A, "GPSMeasureMode"}, + { 0x000B, "GPSDOP"}, + { 0x000C, "GPSSpeedRef"}, + { 0x000D, "GPSSpeed"}, + { 0x000E, "GPSTrackRef"}, + { 0x000F, "GPSTrack"}, + { 0x0010, "GPSImgDirectionRef"}, + { 0x0011, "GPSImgDirection"}, + { 0x0012, "GPSMapDatum"}, + { 0x0013, "GPSDestLatitudeRef"}, + { 0x0014, "GPSDestLatitude"}, + { 0x0015, "GPSDestLongitudeRef"}, + { 0x0016, "GPSDestLongitude"}, + { 0x0017, "GPSDestBearingRef"}, + { 0x0018, "GPSDestBearing"}, + { 0x0019, "GPSDestDistanceRef"}, + { 0x001A, "GPSDestDistance"}, + { 0x001B, "GPSProcessingMode"}, + { 0x001C, "GPSAreaInformation"}, + { 0x001D, "GPSDateStamp"}, + { 0x001E, "GPSDifferential"}, + TAG_TABLE_END +}; + +static tag_info_array tag_table_IOP = { + { 0x0001, "InterOperabilityIndex"}, /* should be 'R98' or 'THM' */ + { 0x0002, "InterOperabilityVersion"}, + { 0x1000, "RelatedFileFormat"}, + { 0x1001, "RelatedImageWidth"}, + { 0x1002, "RelatedImageHeight"}, + TAG_TABLE_END +}; + +static tag_info_array tag_table_VND_CANON = { + { 0x0001, "ModeArray"}, /* guess */ + { 0x0004, "ImageInfo"}, /* guess */ + { 0x0006, "ImageType"}, + { 0x0007, "FirmwareVersion"}, + { 0x0008, "ImageNumber"}, + { 0x0009, "OwnerName"}, + { 0x000C, "Camera"}, + { 0x000F, "CustomFunctions"}, + TAG_TABLE_END +}; + +static tag_info_array tag_table_VND_CASIO = { + { 0x0001, "RecordingMode"}, + { 0x0002, "Quality"}, + { 0x0003, "FocusingMode"}, + { 0x0004, "FlashMode"}, + { 0x0005, "FlashIntensity"}, + { 0x0006, "ObjectDistance"}, + { 0x0007, "WhiteBalance"}, + { 0x000A, "DigitalZoom"}, + { 0x000B, "Sharpness"}, + { 0x000C, "Contrast"}, + { 0x000D, "Saturation"}, + { 0x0014, "CCDSensitivity"}, + TAG_TABLE_END +}; + +static tag_info_array tag_table_VND_FUJI = { + { 0x0000, "Version"}, + { 0x1000, "Quality"}, + { 0x1001, "Sharpness"}, + { 0x1002, "WhiteBalance"}, + { 0x1003, "Color"}, + { 0x1004, "Tone"}, + { 0x1010, "FlashMode"}, + { 0x1011, "FlashStrength"}, + { 0x1020, "Macro"}, + { 0x1021, "FocusMode"}, + { 0x1030, "SlowSync"}, + { 0x1031, "PictureMode"}, + { 0x1100, "ContTake"}, + { 0x1300, "BlurWarning"}, + { 0x1301, "FocusWarning"}, + { 0x1302, "AEWarning "}, + TAG_TABLE_END +}; + +static tag_info_array tag_table_VND_NIKON = { + { 0x0003, "Quality"}, + { 0x0004, "ColorMode"}, + { 0x0005, "ImageAdjustment"}, + { 0x0006, "CCDSensitivity"}, + { 0x0007, "WhiteBalance"}, + { 0x0008, "Focus"}, + { 0x000a, "DigitalZoom"}, + { 0x000b, "Converter"}, + TAG_TABLE_END +}; + +static tag_info_array tag_table_VND_NIKON_990 = { + { 0x0001, "Version"}, + { 0x0002, "ISOSetting"}, + { 0x0003, "ColorMode"}, + { 0x0004, "Quality"}, + { 0x0005, "WhiteBalance"}, + { 0x0006, "ImageSharpening"}, + { 0x0007, "FocusMode"}, + { 0x0008, "FlashSetting"}, + { 0x000F, "ISOSelection"}, + { 0x0080, "ImageAdjustment"}, + { 0x0082, "AuxiliaryLens"}, + { 0x0085, "ManualFocusDistance"}, + { 0x0086, "DigitalZoom"}, + { 0x0088, "AFFocusPosition"}, + { 0x0010, "DataDump"}, + TAG_TABLE_END +}; + +static tag_info_array tag_table_VND_OLYMPUS = { + { 0x0200, "SpecialMode"}, + { 0x0201, "JPEGQuality"}, + { 0x0202, "Macro"}, + { 0x0204, "DigitalZoom"}, + { 0x0207, "SoftwareRelease"}, + { 0x0208, "PictureInfo"}, + { 0x0209, "CameraId"}, + { 0x0F00, "DataDump"}, + TAG_TABLE_END +}; + +typedef enum mn_byte_order_t { + MN_ORDER_INTEL = 0, + MN_ORDER_MOTOROLA = 1, + MN_ORDER_NORMAL +} mn_byte_order_t; + +typedef enum mn_offset_mode_t { + MN_OFFSET_NORMAL, + MN_OFFSET_MAKER, + MN_OFFSET_GUESS +} mn_offset_mode_t; + +typedef struct { + tag_table_type tag_table; + char * make; + char * model; + char * id_string; + int id_string_len; + int offset; + mn_byte_order_t byte_order; + mn_offset_mode_t offset_mode; +} maker_note_type; + +static const maker_note_type maker_note_array[] = { + { tag_table_VND_CANON, "Canon", NULL, NULL, 0, 0, MN_ORDER_INTEL, MN_OFFSET_GUESS}, +/* { tag_table_VND_CANON, "Canon", NULL, NULL, 0, 0, MN_ORDER_NORMAL, MN_OFFSET_NORMAL},*/ + { tag_table_VND_CASIO, "CASIO", NULL, NULL, 0, 0, MN_ORDER_MOTOROLA, MN_OFFSET_NORMAL}, + { tag_table_VND_FUJI, "FUJIFILM", NULL, "FUJIFILM\x0C\x00\x00\x00", 12, 12, MN_ORDER_INTEL, MN_OFFSET_MAKER}, + { tag_table_VND_NIKON, "NIKON", NULL, "Nikon\x00\x01\x00", 8, 8, MN_ORDER_NORMAL, MN_OFFSET_NORMAL}, + { tag_table_VND_NIKON_990, "NIKON", NULL, NULL, 0, 0, MN_ORDER_NORMAL, MN_OFFSET_NORMAL}, + { tag_table_VND_OLYMPUS, "OLYMPUS OPTICAL CO.,LTD", NULL, "OLYMP\x00\x01\x00", 8, 8, MN_ORDER_NORMAL, MN_OFFSET_NORMAL}, +}; +/* }}} */ + +/* {{{ exif_get_tagname + Get headername for tag_num or NULL if not defined */ +static char * exif_get_tagname(int tag_num, char *ret, int len, tag_table_type tag_table TSRMLS_DC) +{ + int i, t; + char tmp[32]; + + for (i = 0; (t = tag_table[i].Tag) != TAG_END_OF_LIST; i++) { + if (t == tag_num) { + if (ret && len) { + strlcpy(ret, tag_table[i].Desc, abs(len)); + if (len < 0) { + memset(ret + strlen(ret), ' ', -len - strlen(ret) - 1); + ret[-len - 1] = '\0'; + } + return ret; + } + return tag_table[i].Desc; + } + } + + if (ret && len) { + snprintf(tmp, sizeof(tmp), "UndefinedTag:0x%04X", tag_num); + strlcpy(ret, tmp, abs(len)); + if (len < 0) { + memset(ret + strlen(ret), ' ', -len - strlen(ret) - 1); + ret[-len - 1] = '\0'; + } + return ret; + } + return ""; +} +/* }}} */ + +/* {{{ exif_char_dump + * Do not use! This is a debug function... */ +#ifdef EXIF_DEBUG +static unsigned char* exif_char_dump(unsigned char * addr, int len, int offset) +{ + static unsigned char buf[4096+1]; + static unsigned char tmp[20]; + int c, i, p=0, n = 5+31; + + p += slprintf(buf+p, sizeof(buf)-p, "\nDump Len: %08X (%d)", len, len); + if (len) { + for(i=0; i<len+15 && p+n<=sizeof(buf); i++) { + if (i%16==0) { + p += slprintf(buf+p, sizeof(buf)-p, "\n%08X: ", i+offset); + } + if (i<len) { + c = *addr++; + p += slprintf(buf+p, sizeof(buf)-p, "%02X ", c); + tmp[i%16] = c>=32 ? c : '.'; + tmp[(i%16)+1] = '\0'; + } else { + p += slprintf(buf+p, sizeof(buf)-p, " "); + } + if (i%16==15) { + p += slprintf(buf+p, sizeof(buf)-p, " %s", tmp); + if (i>=len) { + break; + } + } + } + } + buf[sizeof(buf)-1] = '\0'; + return buf; +} +#endif +/* }}} */ + +/* {{{ php_jpg_get16 + Get 16 bits motorola order (always) for jpeg header stuff. +*/ +static int php_jpg_get16(void *value) +{ + return (((uchar *)value)[0] << 8) | ((uchar *)value)[1]; +} +/* }}} */ + +/* {{{ php_ifd_get16u + * Convert a 16 bit unsigned value from file's native byte order */ +static int php_ifd_get16u(void *value, int motorola_intel) +{ + if (motorola_intel) { + return (((uchar *)value)[0] << 8) | ((uchar *)value)[1]; + } else { + return (((uchar *)value)[1] << 8) | ((uchar *)value)[0]; + } +} +/* }}} */ + +/* {{{ php_ifd_get16s + * Convert a 16 bit signed value from file's native byte order */ +static signed short php_ifd_get16s(void *value, int motorola_intel) +{ + return (signed short)php_ifd_get16u(value, motorola_intel); +} +/* }}} */ + +/* {{{ php_ifd_get32s + * Convert a 32 bit signed value from file's native byte order */ +static int php_ifd_get32s(void *value, int motorola_intel) +{ + if (motorola_intel) { + return (((char *)value)[0] << 24) + | (((uchar *)value)[1] << 16) + | (((uchar *)value)[2] << 8 ) + | (((uchar *)value)[3] ); + } else { + return (((char *)value)[3] << 24) + | (((uchar *)value)[2] << 16) + | (((uchar *)value)[1] << 8 ) + | (((uchar *)value)[0] ); + } +} +/* }}} */ + +/* {{{ php_ifd_get32u + * Write 32 bit unsigned value to data */ +static unsigned php_ifd_get32u(void *value, int motorola_intel) +{ + return (unsigned)php_ifd_get32s(value, motorola_intel) & 0xffffffff; +} +/* }}} */ + +/* {{{ php_ifd_set16u + * Write 16 bit unsigned value to data */ +static void php_ifd_set16u(char *data, unsigned int value, int motorola_intel) +{ + if (motorola_intel) { + data[0] = (value & 0xFF00) >> 8; + data[1] = (value & 0x00FF); + } else { + data[1] = (value & 0xFF00) >> 8; + data[0] = (value & 0x00FF); + } +} +/* }}} */ + +/* {{{ php_ifd_set32u + * Convert a 32 bit unsigned value from file's native byte order */ +static void php_ifd_set32u(char *data, size_t value, int motorola_intel) +{ + if (motorola_intel) { + data[0] = (value & 0xFF000000) >> 24; + data[1] = (value & 0x00FF0000) >> 16; + data[2] = (value & 0x0000FF00) >> 8; + data[3] = (value & 0x000000FF); + } else { + data[3] = (value & 0xFF000000) >> 24; + data[2] = (value & 0x00FF0000) >> 16; + data[1] = (value & 0x0000FF00) >> 8; + data[0] = (value & 0x000000FF); + } +} +/* }}} */ + +#ifdef EXIF_DEBUG +char * exif_dump_data(int *dump_free, int format, int components, int length, int motorola_intel, char *value_ptr TSRMLS_DC) /* {{{ */ +{ + char *dump; + int len; + + *dump_free = 0; + if (format == TAG_FMT_STRING) { + return value_ptr ? value_ptr : "<no data>"; + } + if (format == TAG_FMT_UNDEFINED) { + return "<undefined>\n"; + } + if (format == TAG_FMT_IFD) { + return ""; + } + if (format == TAG_FMT_SINGLE || format == TAG_FMT_DOUBLE) { + return "<not implemented>"; + } + *dump_free = 1; + if (components > 1) { + len = spprintf(&dump, 0, "(%d,%d) {", components, length); + } else { + len = spprintf(&dump, 0, "{"); + } + while(components > 0) { + switch(format) { + case TAG_FMT_BYTE: + case TAG_FMT_UNDEFINED: + case TAG_FMT_STRING: + case TAG_FMT_SBYTE: + dump = erealloc(dump, len + 4 + 1); + snprintf(dump + len, 4 + 1, "0x%02X", *value_ptr); + len += 4; + value_ptr++; + break; + case TAG_FMT_USHORT: + case TAG_FMT_SSHORT: + dump = erealloc(dump, len + 6 + 1); + snprintf(dump + len, 6 + 1, "0x%04X", php_ifd_get16s(value_ptr, motorola_intel)); + len += 6; + value_ptr += 2; + break; + case TAG_FMT_ULONG: + case TAG_FMT_SLONG: + dump = erealloc(dump, len + 6 + 1); + snprintf(dump + len, 6 + 1, "0x%04X", php_ifd_get32s(value_ptr, motorola_intel)); + len += 6; + value_ptr += 4; + break; + case TAG_FMT_URATIONAL: + case TAG_FMT_SRATIONAL: + dump = erealloc(dump, len + 13 + 1); + snprintf(dump + len, 13 + 1, "0x%04X/0x%04X", php_ifd_get32s(value_ptr, motorola_intel), php_ifd_get32s(value_ptr+4, motorola_intel)); + len += 13; + value_ptr += 8; + break; + } + if (components > 0) { + dump = erealloc(dump, len + 2 + 1); + snprintf(dump + len, 2 + 1, ", "); + len += 2; + components--; + } else{ + break; + } + } + dump = erealloc(dump, len + 1 + 1); + snprintf(dump + len, 1 + 1, "}"); + return dump; +} +/* }}} */ +#endif + +/* {{{ exif_convert_any_format + * Evaluate number, be it int, rational, or float from directory. */ +static double exif_convert_any_format(void *value, int format, int motorola_intel TSRMLS_DC) +{ + int s_den; + unsigned u_den; + + switch(format) { + case TAG_FMT_SBYTE: return *(signed char *)value; + case TAG_FMT_BYTE: return *(uchar *)value; + + case TAG_FMT_USHORT: return php_ifd_get16u(value, motorola_intel); + case TAG_FMT_ULONG: return php_ifd_get32u(value, motorola_intel); + + case TAG_FMT_URATIONAL: + u_den = php_ifd_get32u(4+(char *)value, motorola_intel); + if (u_den == 0) { + return 0; + } else { + return (double)php_ifd_get32u(value, motorola_intel) / u_den; + } + + case TAG_FMT_SRATIONAL: + s_den = php_ifd_get32s(4+(char *)value, motorola_intel); + if (s_den == 0) { + return 0; + } else { + return (double)php_ifd_get32s(value, motorola_intel) / s_den; + } + + case TAG_FMT_SSHORT: return (signed short)php_ifd_get16u(value, motorola_intel); + case TAG_FMT_SLONG: return php_ifd_get32s(value, motorola_intel); + + /* Not sure if this is correct (never seen float used in Exif format) */ + case TAG_FMT_SINGLE: +#ifdef EXIF_DEBUG + php_error_docref(NULL TSRMLS_CC, E_NOTICE, "Found value of type single"); +#endif + return (double)*(float *)value; + case TAG_FMT_DOUBLE: +#ifdef EXIF_DEBUG + php_error_docref(NULL TSRMLS_CC, E_NOTICE, "Found value of type double"); +#endif + return *(double *)value; + } + return 0; +} +/* }}} */ + +/* {{{ exif_convert_any_to_int + * Evaluate number, be it int, rational, or float from directory. */ +static size_t exif_convert_any_to_int(void *value, int format, int motorola_intel TSRMLS_DC) +{ + int s_den; + unsigned u_den; + + switch(format) { + case TAG_FMT_SBYTE: return *(signed char *)value; + case TAG_FMT_BYTE: return *(uchar *)value; + + case TAG_FMT_USHORT: return php_ifd_get16u(value, motorola_intel); + case TAG_FMT_ULONG: return php_ifd_get32u(value, motorola_intel); + + case TAG_FMT_URATIONAL: + u_den = php_ifd_get32u(4+(char *)value, motorola_intel); + if (u_den == 0) { + return 0; + } else { + return php_ifd_get32u(value, motorola_intel) / u_den; + } + + case TAG_FMT_SRATIONAL: + s_den = php_ifd_get32s(4+(char *)value, motorola_intel); + if (s_den == 0) { + return 0; + } else { + return php_ifd_get32s(value, motorola_intel) / s_den; + } + + case TAG_FMT_SSHORT: return php_ifd_get16u(value, motorola_intel); + case TAG_FMT_SLONG: return php_ifd_get32s(value, motorola_intel); + + /* Not sure if this is correct (never seen float used in Exif format) */ + case TAG_FMT_SINGLE: +#ifdef EXIF_DEBUG + php_error_docref(NULL TSRMLS_CC, E_NOTICE, "Found value of type single"); +#endif + return (size_t)*(float *)value; + case TAG_FMT_DOUBLE: +#ifdef EXIF_DEBUG + php_error_docref(NULL TSRMLS_CC, E_NOTICE, "Found value of type double"); +#endif + return (size_t)*(double *)value; + } + return 0; +} +/* }}} */ + +/* {{{ struct image_info_value, image_info_list +*/ +#ifndef WORD +#define WORD unsigned short +#endif +#ifndef DWORD +#define DWORD unsigned int +#endif + +typedef struct { + int num; + int den; +} signed_rational; + +typedef struct { + unsigned int num; + unsigned int den; +} unsigned_rational; + +typedef union _image_info_value { + char *s; + unsigned u; + int i; + float f; + double d; + signed_rational sr; + unsigned_rational ur; + union _image_info_value *list; +} image_info_value; + +typedef struct { + WORD tag; + WORD format; + DWORD length; + DWORD dummy; /* value ptr of tiff directory entry */ + char *name; + image_info_value value; +} image_info_data; + +typedef struct { + int count; + image_info_data *list; +} image_info_list; +/* }}} */ + +/* {{{ exif_get_sectionname + Returns the name of a section +*/ +#define SECTION_FILE 0 +#define SECTION_COMPUTED 1 +#define SECTION_ANY_TAG 2 +#define SECTION_IFD0 3 +#define SECTION_THUMBNAIL 4 +#define SECTION_COMMENT 5 +#define SECTION_APP0 6 +#define SECTION_EXIF 7 +#define SECTION_FPIX 8 +#define SECTION_GPS 9 +#define SECTION_INTEROP 10 +#define SECTION_APP12 11 +#define SECTION_WINXP 12 +#define SECTION_MAKERNOTE 13 +#define SECTION_COUNT 14 + +#define FOUND_FILE (1<<SECTION_FILE) +#define FOUND_COMPUTED (1<<SECTION_COMPUTED) +#define FOUND_ANY_TAG (1<<SECTION_ANY_TAG) +#define FOUND_IFD0 (1<<SECTION_IFD0) +#define FOUND_THUMBNAIL (1<<SECTION_THUMBNAIL) +#define FOUND_COMMENT (1<<SECTION_COMMENT) +#define FOUND_APP0 (1<<SECTION_APP0) +#define FOUND_EXIF (1<<SECTION_EXIF) +#define FOUND_FPIX (1<<SECTION_FPIX) +#define FOUND_GPS (1<<SECTION_GPS) +#define FOUND_INTEROP (1<<SECTION_INTEROP) +#define FOUND_APP12 (1<<SECTION_APP12) +#define FOUND_WINXP (1<<SECTION_WINXP) +#define FOUND_MAKERNOTE (1<<SECTION_MAKERNOTE) + +static char *exif_get_sectionname(int section) +{ + switch(section) { + case SECTION_FILE: return "FILE"; + case SECTION_COMPUTED: return "COMPUTED"; + case SECTION_ANY_TAG: return "ANY_TAG"; + case SECTION_IFD0: return "IFD0"; + case SECTION_THUMBNAIL: return "THUMBNAIL"; + case SECTION_COMMENT: return "COMMENT"; + case SECTION_APP0: return "APP0"; + case SECTION_EXIF: return "EXIF"; + case SECTION_FPIX: return "FPIX"; + case SECTION_GPS: return "GPS"; + case SECTION_INTEROP: return "INTEROP"; + case SECTION_APP12: return "APP12"; + case SECTION_WINXP: return "WINXP"; + case SECTION_MAKERNOTE: return "MAKERNOTE"; + } + return ""; +} + +static tag_table_type exif_get_tag_table(int section) +{ + switch(section) { + case SECTION_FILE: return &tag_table_IFD[0]; + case SECTION_COMPUTED: return &tag_table_IFD[0]; + case SECTION_ANY_TAG: return &tag_table_IFD[0]; + case SECTION_IFD0: return &tag_table_IFD[0]; + case SECTION_THUMBNAIL: return &tag_table_IFD[0]; + case SECTION_COMMENT: return &tag_table_IFD[0]; + case SECTION_APP0: return &tag_table_IFD[0]; + case SECTION_EXIF: return &tag_table_IFD[0]; + case SECTION_FPIX: return &tag_table_IFD[0]; + case SECTION_GPS: return &tag_table_GPS[0]; + case SECTION_INTEROP: return &tag_table_IOP[0]; + case SECTION_APP12: return &tag_table_IFD[0]; + case SECTION_WINXP: return &tag_table_IFD[0]; + } + return &tag_table_IFD[0]; +} +/* }}} */ + +/* {{{ exif_get_sectionlist + Return list of sectionnames specified by sectionlist. Return value must be freed +*/ +static char *exif_get_sectionlist(int sectionlist TSRMLS_DC) +{ + int i, len, ml = 0; + char *sections; + + for(i=0; i<SECTION_COUNT; i++) { + ml += strlen(exif_get_sectionname(i))+2; + } + sections = safe_emalloc(ml, 1, 1); + sections[0] = '\0'; + len = 0; + for(i=0; i<SECTION_COUNT; i++) { + if (sectionlist&(1<<i)) { + snprintf(sections+len, ml-len, "%s, ", exif_get_sectionname(i)); + len = strlen(sections); + } + } + if (len>2) + sections[len-2] = '\0'; + return sections; +} +/* }}} */ + +/* {{{ struct image_info_type + This structure stores Exif header image elements in a simple manner + Used to store camera data as extracted from the various ways that it can be + stored in a nexif header +*/ + +typedef struct { + int type; + size_t size; + uchar *data; +} file_section; + +typedef struct { + int count; + file_section *list; +} file_section_list; + +typedef struct { + image_filetype filetype; + size_t width, height; + size_t size; + size_t offset; + char *data; +} thumbnail_data; + +typedef struct { + char *value; + size_t size; + int tag; +} xp_field_type; + +typedef struct { + int count; + xp_field_type *list; +} xp_field_list; + +/* This structure is used to store a section of a Jpeg file. */ +typedef struct { + php_stream *infile; + char *FileName; + time_t FileDateTime; + size_t FileSize; + image_filetype FileType; + int Height, Width; + int IsColor; + + char *make; + char *model; + + float ApertureFNumber; + float ExposureTime; + double FocalplaneUnits; + float CCDWidth; + double FocalplaneXRes; + size_t ExifImageWidth; + float FocalLength; + float Distance; + + int motorola_intel; /* 1 Motorola; 0 Intel */ + + char *UserComment; + int UserCommentLength; + char *UserCommentEncoding; + char *encode_unicode; + char *decode_unicode_be; + char *decode_unicode_le; + char *encode_jis; + char *decode_jis_be; + char *decode_jis_le; + char *Copyright;/* EXIF standard defines Copyright as "<Photographer> [ '\0' <Editor> ] ['\0']" */ + char *CopyrightPhotographer; + char *CopyrightEditor; + + xp_field_list xp_fields; + + thumbnail_data Thumbnail; + /* other */ + int sections_found; /* FOUND_<marker> */ + image_info_list info_list[SECTION_COUNT]; + /* for parsing */ + int read_thumbnail; + int read_all; + int ifd_nesting_level; + /* internal */ + file_section_list file; +} image_info_type; +/* }}} */ + +/* {{{ exif_error_docref */ +static void exif_error_docref(const char *docref EXIFERR_DC, const image_info_type *ImageInfo, int type, const char *format, ...) +{ + va_list args; + + va_start(args, format); +#ifdef EXIF_DEBUG + { + char *buf; + + spprintf(&buf, 0, "%s(%d): %s", _file, _line, format); + php_verror(docref, ImageInfo->FileName?ImageInfo->FileName:"", type, buf, args TSRMLS_CC); + efree(buf); + } +#else + php_verror(docref, ImageInfo->FileName?ImageInfo->FileName:"", type, format, args TSRMLS_CC); +#endif + va_end(args); +} +/* }}} */ + +/* {{{ jpeg_sof_info + */ +typedef struct { + int bits_per_sample; + size_t width; + size_t height; + int num_components; +} jpeg_sof_info; +/* }}} */ + +/* {{{ exif_file_sections_add + Add a file_section to image_info + returns the used block or -1. if size>0 and data == NULL buffer of size is allocated +*/ +static int exif_file_sections_add(image_info_type *ImageInfo, int type, size_t size, uchar *data) +{ + file_section *tmp; + int count = ImageInfo->file.count; + + tmp = safe_erealloc(ImageInfo->file.list, (count+1), sizeof(file_section), 0); + ImageInfo->file.list = tmp; + ImageInfo->file.list[count].type = 0xFFFF; + ImageInfo->file.list[count].data = NULL; + ImageInfo->file.list[count].size = 0; + ImageInfo->file.count = count+1; + if (!size) { + data = NULL; + } else if (data == NULL) { + data = safe_emalloc(size, 1, 0); + } + ImageInfo->file.list[count].type = type; + ImageInfo->file.list[count].data = data; + ImageInfo->file.list[count].size = size; + return count; +} +/* }}} */ + +/* {{{ exif_file_sections_realloc + Reallocate a file section returns 0 on success and -1 on failure +*/ +static int exif_file_sections_realloc(image_info_type *ImageInfo, int section_index, size_t size TSRMLS_DC) +{ + void *tmp; + + /* This is not a malloc/realloc check. It is a plausibility check for the + * function parameters (requirements engineering). + */ + if (section_index >= ImageInfo->file.count) { + EXIF_ERRLOG_FSREALLOC(ImageInfo) + return -1; + } + tmp = safe_erealloc(ImageInfo->file.list[section_index].data, 1, size, 0); + ImageInfo->file.list[section_index].data = tmp; + ImageInfo->file.list[section_index].size = size; + return 0; +} +/* }}} */ + +/* {{{ exif_file_section_free + Discard all file_sections in ImageInfo +*/ +static int exif_file_sections_free(image_info_type *ImageInfo) +{ + int i; + + if (ImageInfo->file.count) { + for (i=0; i<ImageInfo->file.count; i++) { + EFREE_IF(ImageInfo->file.list[i].data); + } + } + EFREE_IF(ImageInfo->file.list); + ImageInfo->file.count = 0; + return TRUE; +} +/* }}} */ + +/* {{{ exif_iif_add_value + Add a value to image_info +*/ +static void exif_iif_add_value(image_info_type *image_info, int section_index, char *name, int tag, int format, int length, void* value, int motorola_intel TSRMLS_DC) +{ + size_t idex; + void *vptr; + image_info_value *info_value; + image_info_data *info_data; + image_info_data *list; + + if (length < 0) { + return; + } + + list = safe_erealloc(image_info->info_list[section_index].list, (image_info->info_list[section_index].count+1), sizeof(image_info_data), 0); + image_info->info_list[section_index].list = list; + + info_data = &image_info->info_list[section_index].list[image_info->info_list[section_index].count]; + memset(info_data, 0, sizeof(image_info_data)); + info_data->tag = tag; + info_data->format = format; + info_data->length = length; + info_data->name = estrdup(name); + info_value = &info_data->value; + + switch (format) { + case TAG_FMT_STRING: + if (value) { + length = php_strnlen(value, length); + info_value->s = estrndup(value, length); + info_data->length = length; + } else { + info_data->length = 0; + info_value->s = estrdup(""); + } + break; + + default: + /* Standard says more types possible but skip them... + * but allow users to handle data if they know how to + * So not return but use type UNDEFINED + * return; + */ + info_data->tag = TAG_FMT_UNDEFINED;/* otherwise not freed from memory */ + case TAG_FMT_SBYTE: + case TAG_FMT_BYTE: + /* in contrast to strings bytes do not need to allocate buffer for NULL if length==0 */ + if (!length) + break; + case TAG_FMT_UNDEFINED: + if (value) { + /* do not recompute length here */ + info_value->s = estrndup(value, length); + info_data->length = length; + } else { + info_data->length = 0; + info_value->s = estrdup(""); + } + break; + + case TAG_FMT_USHORT: + case TAG_FMT_ULONG: + case TAG_FMT_URATIONAL: + case TAG_FMT_SSHORT: + case TAG_FMT_SLONG: + case TAG_FMT_SRATIONAL: + case TAG_FMT_SINGLE: + case TAG_FMT_DOUBLE: + if (length==0) { + break; + } else + if (length>1) { + info_value->list = safe_emalloc(length, sizeof(image_info_value), 0); + } else { + info_value = &info_data->value; + } + for (idex=0,vptr=value; idex<(size_t)length; idex++,vptr=(char *) vptr + php_tiff_bytes_per_format[format]) { + if (length>1) { + info_value = &info_data->value.list[idex]; + } + switch (format) { + case TAG_FMT_USHORT: + info_value->u = php_ifd_get16u(vptr, motorola_intel); + break; + + case TAG_FMT_ULONG: + info_value->u = php_ifd_get32u(vptr, motorola_intel); + break; + + case TAG_FMT_URATIONAL: + info_value->ur.num = php_ifd_get32u(vptr, motorola_intel); + info_value->ur.den = php_ifd_get32u(4+(char *)vptr, motorola_intel); + break; + + case TAG_FMT_SSHORT: + info_value->i = php_ifd_get16s(vptr, motorola_intel); + break; + + case TAG_FMT_SLONG: + info_value->i = php_ifd_get32s(vptr, motorola_intel); + break; + + case TAG_FMT_SRATIONAL: + info_value->sr.num = php_ifd_get32u(vptr, motorola_intel); + info_value->sr.den = php_ifd_get32u(4+(char *)vptr, motorola_intel); + break; + + case TAG_FMT_SINGLE: +#ifdef EXIF_DEBUG + php_error_docref(NULL TSRMLS_CC, E_WARNING, "Found value of type single"); +#endif + info_value->f = *(float *)value; + + case TAG_FMT_DOUBLE: +#ifdef EXIF_DEBUG + php_error_docref(NULL TSRMLS_CC, E_WARNING, "Found value of type double"); +#endif + info_value->d = *(double *)value; + break; + } + } + } + image_info->sections_found |= 1<<section_index; + image_info->info_list[section_index].count++; +} +/* }}} */ + +/* {{{ exif_iif_add_tag + Add a tag from IFD to image_info +*/ +static void exif_iif_add_tag(image_info_type *image_info, int section_index, char *name, int tag, int format, size_t length, void* value TSRMLS_DC) +{ + exif_iif_add_value(image_info, section_index, name, tag, format, (int)length, value, image_info->motorola_intel TSRMLS_CC); +} +/* }}} */ + +/* {{{ exif_iif_add_int + Add an int value to image_info +*/ +static void exif_iif_add_int(image_info_type *image_info, int section_index, char *name, int value TSRMLS_DC) +{ + image_info_data *info_data; + image_info_data *list; + + list = safe_erealloc(image_info->info_list[section_index].list, (image_info->info_list[section_index].count+1), sizeof(image_info_data), 0); + image_info->info_list[section_index].list = list; + + info_data = &image_info->info_list[section_index].list[image_info->info_list[section_index].count]; + info_data->tag = TAG_NONE; + info_data->format = TAG_FMT_SLONG; + info_data->length = 1; + info_data->name = estrdup(name); + info_data->value.i = value; + image_info->sections_found |= 1<<section_index; + image_info->info_list[section_index].count++; +} +/* }}} */ + +/* {{{ exif_iif_add_str + Add a string value to image_info MUST BE NUL TERMINATED +*/ +static void exif_iif_add_str(image_info_type *image_info, int section_index, char *name, char *value TSRMLS_DC) +{ + image_info_data *info_data; + image_info_data *list; + + if (value) { + list = safe_erealloc(image_info->info_list[section_index].list, (image_info->info_list[section_index].count+1), sizeof(image_info_data), 0); + image_info->info_list[section_index].list = list; + info_data = &image_info->info_list[section_index].list[image_info->info_list[section_index].count]; + info_data->tag = TAG_NONE; + info_data->format = TAG_FMT_STRING; + info_data->length = 1; + info_data->name = estrdup(name); + info_data->value.s = estrdup(value); + image_info->sections_found |= 1<<section_index; + image_info->info_list[section_index].count++; + } +} +/* }}} */ + +/* {{{ exif_iif_add_fmt + Add a format string value to image_info MUST BE NUL TERMINATED +*/ +static void exif_iif_add_fmt(image_info_type *image_info, int section_index, char *name TSRMLS_DC, char *value, ...) +{ + char *tmp; + va_list arglist; + + va_start(arglist, value); + if (value) { + vspprintf(&tmp, 0, value, arglist); + exif_iif_add_str(image_info, section_index, name, tmp TSRMLS_CC); + efree(tmp); + } + va_end(arglist); +} +/* }}} */ + +/* {{{ exif_iif_add_str + Add a string value to image_info MUST BE NUL TERMINATED +*/ +static void exif_iif_add_buffer(image_info_type *image_info, int section_index, char *name, int length, char *value TSRMLS_DC) +{ + image_info_data *info_data; + image_info_data *list; + + if (value) { + list = safe_erealloc(image_info->info_list[section_index].list, (image_info->info_list[section_index].count+1), sizeof(image_info_data), 0); + image_info->info_list[section_index].list = list; + info_data = &image_info->info_list[section_index].list[image_info->info_list[section_index].count]; + info_data->tag = TAG_NONE; + info_data->format = TAG_FMT_UNDEFINED; + info_data->length = length; + info_data->name = estrdup(name); + info_data->value.s = safe_emalloc(length, 1, 1); + memcpy(info_data->value.s, value, length); + info_data->value.s[length] = 0; + image_info->sections_found |= 1<<section_index; + image_info->info_list[section_index].count++; + } +} +/* }}} */ + +/* {{{ exif_iif_free + Free memory allocated for image_info +*/ +static void exif_iif_free(image_info_type *image_info, int section_index) { + int i; + void *f; /* faster */ + + if (image_info->info_list[section_index].count) { + for (i=0; i < image_info->info_list[section_index].count; i++) { + if ((f=image_info->info_list[section_index].list[i].name) != NULL) { + efree(f); + } + switch(image_info->info_list[section_index].list[i].format) { + case TAG_FMT_SBYTE: + case TAG_FMT_BYTE: + /* in contrast to strings bytes do not need to allocate buffer for NULL if length==0 */ + if (image_info->info_list[section_index].list[i].length<1) + break; + default: + case TAG_FMT_UNDEFINED: + case TAG_FMT_STRING: + if ((f=image_info->info_list[section_index].list[i].value.s) != NULL) { + efree(f); + } + break; + + case TAG_FMT_USHORT: + case TAG_FMT_ULONG: + case TAG_FMT_URATIONAL: + case TAG_FMT_SSHORT: + case TAG_FMT_SLONG: + case TAG_FMT_SRATIONAL: + case TAG_FMT_SINGLE: + case TAG_FMT_DOUBLE: + /* nothing to do here */ + if (image_info->info_list[section_index].list[i].length > 1) { + if ((f=image_info->info_list[section_index].list[i].value.list) != NULL) { + efree(f); + } + } + break; + } + } + } + EFREE_IF(image_info->info_list[section_index].list); +} +/* }}} */ + +/* {{{ add_assoc_image_info + * Add image_info to associative array value. */ +static void add_assoc_image_info(zval *value, int sub_array, image_info_type *image_info, int section_index TSRMLS_DC) +{ + char buffer[64], *val, *name, uname[64]; + int i, ap, l, b, idx=0, unknown=0; +#ifdef EXIF_DEBUG + int info_tag; +#endif + image_info_value *info_value; + image_info_data *info_data; + zval *tmpi, *array = NULL; + +#ifdef EXIF_DEBUG +/* php_error_docref(NULL TSRMLS_CC, E_NOTICE, "Adding %d infos from section %s", image_info->info_list[section_index].count, exif_get_sectionname(section_index));*/ +#endif + if (image_info->info_list[section_index].count) { + if (sub_array) { + MAKE_STD_ZVAL(tmpi); + array_init(tmpi); + } else { + tmpi = value; + } + + for(i=0; i<image_info->info_list[section_index].count; i++) { + info_data = &image_info->info_list[section_index].list[i]; +#ifdef EXIF_DEBUG + info_tag = info_data->tag; /* conversion */ +#endif + info_value = &info_data->value; + if (!(name = info_data->name)) { + snprintf(uname, sizeof(uname), "%d", unknown++); + name = uname; + } +#ifdef EXIF_DEBUG +/* php_error_docref(NULL TSRMLS_CC, E_NOTICE, "Adding infos: tag(0x%04X,%12s,L=0x%04X): %s", info_tag, exif_get_tagname(info_tag, buffer, -12, exif_get_tag_table(section_index) TSRMLS_CC), info_data->length, info_data->format==TAG_FMT_STRING?(info_value&&info_value->s?info_value->s:"<no data>"):exif_get_tagformat(info_data->format));*/ +#endif + if (info_data->length==0) { + add_assoc_null(tmpi, name); + } else { + switch (info_data->format) { + default: + /* Standard says more types possible but skip them... + * but allow users to handle data if they know how to + * So not return but use type UNDEFINED + * return; + */ + case TAG_FMT_BYTE: + case TAG_FMT_SBYTE: + case TAG_FMT_UNDEFINED: + if (!info_value->s) { + add_assoc_stringl(tmpi, name, "", 0, 1); + } else { + add_assoc_stringl(tmpi, name, info_value->s, info_data->length, 1); + } + break; + + case TAG_FMT_STRING: + if (!(val = info_value->s)) { + val = ""; + } + if (section_index==SECTION_COMMENT) { + add_index_string(tmpi, idx++, val, 1); + } else { + add_assoc_string(tmpi, name, val, 1); + } + break; + + case TAG_FMT_URATIONAL: + case TAG_FMT_SRATIONAL: + /*case TAG_FMT_BYTE: + case TAG_FMT_SBYTE:*/ + case TAG_FMT_USHORT: + case TAG_FMT_SSHORT: + case TAG_FMT_SINGLE: + case TAG_FMT_DOUBLE: + case TAG_FMT_ULONG: + case TAG_FMT_SLONG: + /* now the rest, first see if it becomes an array */ + if ((l = info_data->length) > 1) { + array = NULL; + MAKE_STD_ZVAL(array); + array_init(array); + } + for(ap=0; ap<l; ap++) { + if (l>1) { + info_value = &info_data->value.list[ap]; + } + switch (info_data->format) { + case TAG_FMT_BYTE: + if (l>1) { + info_value = &info_data->value; + for (b=0;b<l;b++) { + add_index_long(array, b, (int)(info_value->s[b])); + } + break; + } + case TAG_FMT_USHORT: + case TAG_FMT_ULONG: + if (l==1) { + add_assoc_long(tmpi, name, (int)info_value->u); + } else { + add_index_long(array, ap, (int)info_value->u); + } + break; + + case TAG_FMT_URATIONAL: + snprintf(buffer, sizeof(buffer), "%i/%i", info_value->ur.num, info_value->ur.den); + if (l==1) { + add_assoc_string(tmpi, name, buffer, 1); + } else { + add_index_string(array, ap, buffer, 1); + } + break; + + case TAG_FMT_SBYTE: + if (l>1) { + info_value = &info_data->value; + for (b=0;b<l;b++) { + add_index_long(array, ap, (int)info_value->s[b]); + } + break; + } + case TAG_FMT_SSHORT: + case TAG_FMT_SLONG: + if (l==1) { + add_assoc_long(tmpi, name, info_value->i); + } else { + add_index_long(array, ap, info_value->i); + } + break; + + case TAG_FMT_SRATIONAL: + snprintf(buffer, sizeof(buffer), "%i/%i", info_value->sr.num, info_value->sr.den); + if (l==1) { + add_assoc_string(tmpi, name, buffer, 1); + } else { + add_index_string(array, ap, buffer, 1); + } + break; + + case TAG_FMT_SINGLE: + if (l==1) { + add_assoc_double(tmpi, name, info_value->f); + } else { + add_index_double(array, ap, info_value->f); + } + break; + + case TAG_FMT_DOUBLE: + if (l==1) { + add_assoc_double(tmpi, name, info_value->d); + } else { + add_index_double(array, ap, info_value->d); + } + break; + } + info_value = &info_data->value.list[ap]; + } + if (l>1) { + add_assoc_zval(tmpi, name, array); + } + break; + } + } + } + if (sub_array) { + add_assoc_zval(value, exif_get_sectionname(section_index), tmpi); + } + } +} +/* }}} */ + +/* {{{ Markers + JPEG markers consist of one or more 0xFF bytes, followed by a marker + code byte (which is not an FF). Here are the marker codes of interest + in this program. (See jdmarker.c for a more complete list.) +*/ + +#define M_TEM 0x01 /* temp for arithmetic coding */ +#define M_RES 0x02 /* reserved */ +#define M_SOF0 0xC0 /* Start Of Frame N */ +#define M_SOF1 0xC1 /* N indicates which compression process */ +#define M_SOF2 0xC2 /* Only SOF0-SOF2 are now in common use */ +#define M_SOF3 0xC3 +#define M_DHT 0xC4 +#define M_SOF5 0xC5 /* NB: codes C4 and CC are NOT SOF markers */ +#define M_SOF6 0xC6 +#define M_SOF7 0xC7 +#define M_JPEG 0x08 /* reserved for extensions */ +#define M_SOF9 0xC9 +#define M_SOF10 0xCA +#define M_SOF11 0xCB +#define M_DAC 0xCC /* arithmetic table */ +#define M_SOF13 0xCD +#define M_SOF14 0xCE +#define M_SOF15 0xCF +#define M_RST0 0xD0 /* restart segment */ +#define M_RST1 0xD1 +#define M_RST2 0xD2 +#define M_RST3 0xD3 +#define M_RST4 0xD4 +#define M_RST5 0xD5 +#define M_RST6 0xD6 +#define M_RST7 0xD7 +#define M_SOI 0xD8 /* Start Of Image (beginning of datastream) */ +#define M_EOI 0xD9 /* End Of Image (end of datastream) */ +#define M_SOS 0xDA /* Start Of Scan (begins compressed data) */ +#define M_DQT 0xDB +#define M_DNL 0xDC +#define M_DRI 0xDD +#define M_DHP 0xDE +#define M_EXP 0xDF +#define M_APP0 0xE0 /* JPEG: 'JFIFF' AND (additional 'JFXX') */ +#define M_EXIF 0xE1 /* Exif Attribute Information */ +#define M_APP2 0xE2 /* Flash Pix Extension Data? */ +#define M_APP3 0xE3 +#define M_APP4 0xE4 +#define M_APP5 0xE5 +#define M_APP6 0xE6 +#define M_APP7 0xE7 +#define M_APP8 0xE8 +#define M_APP9 0xE9 +#define M_APP10 0xEA +#define M_APP11 0xEB +#define M_APP12 0xEC +#define M_APP13 0xED /* IPTC International Press Telecommunications Council */ +#define M_APP14 0xEE /* Software, Copyright? */ +#define M_APP15 0xEF +#define M_JPG0 0xF0 +#define M_JPG1 0xF1 +#define M_JPG2 0xF2 +#define M_JPG3 0xF3 +#define M_JPG4 0xF4 +#define M_JPG5 0xF5 +#define M_JPG6 0xF6 +#define M_JPG7 0xF7 +#define M_JPG8 0xF8 +#define M_JPG9 0xF9 +#define M_JPG10 0xFA +#define M_JPG11 0xFB +#define M_JPG12 0xFC +#define M_JPG13 0xFD +#define M_COM 0xFE /* COMment */ + +#define M_PSEUDO 0x123 /* Extra value. */ + +/* }}} */ + +/* {{{ jpeg2000 markers + */ +/* Markers x30 - x3F do not have a segment */ +/* Markers x00, x01, xFE, xC0 - xDF ISO/IEC 10918-1 -> M_<xx> */ +/* Markers xF0 - xF7 ISO/IEC 10918-3 */ +/* Markers xF7 - xF8 ISO/IEC 14495-1 */ +/* XY=Main/Tile-header:(R:required, N:not_allowed, O:optional, L:last_marker) */ +#define JC_SOC 0x4F /* NN, Start of codestream */ +#define JC_SIZ 0x51 /* RN, Image and tile size */ +#define JC_COD 0x52 /* RO, Codeing style defaulte */ +#define JC_COC 0x53 /* OO, Coding style component */ +#define JC_TLM 0x55 /* ON, Tile part length main header */ +#define JC_PLM 0x57 /* ON, Packet length main header */ +#define JC_PLT 0x58 /* NO, Packet length tile part header */ +#define JC_QCD 0x5C /* RO, Quantization default */ +#define JC_QCC 0x5D /* OO, Quantization component */ +#define JC_RGN 0x5E /* OO, Region of interest */ +#define JC_POD 0x5F /* OO, Progression order default */ +#define JC_PPM 0x60 /* ON, Packed packet headers main header */ +#define JC_PPT 0x61 /* NO, Packet packet headers tile part header */ +#define JC_CME 0x64 /* OO, Comment: "LL E <text>" E=0:binary, E=1:ascii */ +#define JC_SOT 0x90 /* NR, Start of tile */ +#define JC_SOP 0x91 /* NO, Start of packeter default */ +#define JC_EPH 0x92 /* NO, End of packet header */ +#define JC_SOD 0x93 /* NL, Start of data */ +#define JC_EOC 0xD9 /* NN, End of codestream */ +/* }}} */ + +/* {{{ exif_process_COM + Process a COM marker. + We want to print out the marker contents as legible text; + we must guard against random junk and varying newline representations. +*/ +static void exif_process_COM (image_info_type *image_info, char *value, size_t length TSRMLS_DC) +{ + exif_iif_add_tag(image_info, SECTION_COMMENT, "Comment", TAG_COMPUTED_VALUE, TAG_FMT_STRING, length-2, value+2 TSRMLS_CC); +} +/* }}} */ + +/* {{{ exif_process_CME + Process a CME marker. + We want to print out the marker contents as legible text; + we must guard against random junk and varying newline representations. +*/ +#ifdef EXIF_JPEG2000 +static void exif_process_CME (image_info_type *image_info, char *value, size_t length TSRMLS_DC) +{ + if (length>3) { + switch(value[2]) { + case 0: + exif_iif_add_tag(image_info, SECTION_COMMENT, "Comment", TAG_COMPUTED_VALUE, TAG_FMT_UNDEFINED, length, value TSRMLS_CC); + break; + case 1: + exif_iif_add_tag(image_info, SECTION_COMMENT, "Comment", TAG_COMPUTED_VALUE, TAG_FMT_STRING, length, value); + break; + default: + php_error_docref(NULL TSRMLS_CC, E_NOTICE, "Undefined JPEG2000 comment encoding"); + break; + } + } else { + exif_iif_add_tag(image_info, SECTION_COMMENT, "Comment", TAG_COMPUTED_VALUE, TAG_FMT_UNDEFINED, 0, NULL); + php_error_docref(NULL TSRMLS_CC, E_NOTICE, "JPEG2000 comment section too small"); + } +} +#endif +/* }}} */ + +/* {{{ exif_process_SOFn + * Process a SOFn marker. This is useful for the image dimensions */ +static void exif_process_SOFn (uchar *Data, int marker, jpeg_sof_info *result) +{ +/* 0xFF SOSn SectLen(2) Bits(1) Height(2) Width(2) Channels(1) 3*Channels (1) */ + result->bits_per_sample = Data[2]; + result->height = php_jpg_get16(Data+3); + result->width = php_jpg_get16(Data+5); + result->num_components = Data[7]; + +/* switch (marker) { + case M_SOF0: process = "Baseline"; break; + case M_SOF1: process = "Extended sequential"; break; + case M_SOF2: process = "Progressive"; break; + case M_SOF3: process = "Lossless"; break; + case M_SOF5: process = "Differential sequential"; break; + case M_SOF6: process = "Differential progressive"; break; + case M_SOF7: process = "Differential lossless"; break; + case M_SOF9: process = "Extended sequential, arithmetic coding"; break; + case M_SOF10: process = "Progressive, arithmetic coding"; break; + case M_SOF11: process = "Lossless, arithmetic coding"; break; + case M_SOF13: process = "Differential sequential, arithmetic coding"; break; + case M_SOF14: process = "Differential progressive, arithmetic coding"; break; + case M_SOF15: process = "Differential lossless, arithmetic coding"; break; + default: process = "Unknown"; break; + }*/ +} +/* }}} */ + +/* forward declarations */ +static int exif_process_IFD_in_JPEG(image_info_type *ImageInfo, char *dir_start, char *offset_base, size_t IFDlength, size_t displacement, int section_index TSRMLS_DC); +static int exif_process_IFD_TAG( image_info_type *ImageInfo, char *dir_entry, char *offset_base, size_t IFDlength, size_t displacement, int section_index, int ReadNextIFD, tag_table_type tag_table TSRMLS_DC); + +/* {{{ exif_get_markername + Get name of marker */ +#ifdef EXIF_DEBUG +static char * exif_get_markername(int marker) +{ + switch(marker) { + case 0xC0: return "SOF0"; + case 0xC1: return "SOF1"; + case 0xC2: return "SOF2"; + case 0xC3: return "SOF3"; + case 0xC4: return "DHT"; + case 0xC5: return "SOF5"; + case 0xC6: return "SOF6"; + case 0xC7: return "SOF7"; + case 0xC9: return "SOF9"; + case 0xCA: return "SOF10"; + case 0xCB: return "SOF11"; + case 0xCD: return "SOF13"; + case 0xCE: return "SOF14"; + case 0xCF: return "SOF15"; + case 0xD8: return "SOI"; + case 0xD9: return "EOI"; + case 0xDA: return "SOS"; + case 0xDB: return "DQT"; + case 0xDC: return "DNL"; + case 0xDD: return "DRI"; + case 0xDE: return "DHP"; + case 0xDF: return "EXP"; + case 0xE0: return "APP0"; + case 0xE1: return "EXIF"; + case 0xE2: return "FPIX"; + case 0xE3: return "APP3"; + case 0xE4: return "APP4"; + case 0xE5: return "APP5"; + case 0xE6: return "APP6"; + case 0xE7: return "APP7"; + case 0xE8: return "APP8"; + case 0xE9: return "APP9"; + case 0xEA: return "APP10"; + case 0xEB: return "APP11"; + case 0xEC: return "APP12"; + case 0xED: return "APP13"; + case 0xEE: return "APP14"; + case 0xEF: return "APP15"; + case 0xF0: return "JPG0"; + case 0xFD: return "JPG13"; + case 0xFE: return "COM"; + case 0x01: return "TEM"; + } + return "Unknown"; +} +#endif +/* }}} */ + +/* {{{ proto string exif_tagname(index) + Get headername for index or false if not defined */ +PHP_FUNCTION(exif_tagname) +{ + long tag; + char *szTemp; + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &tag) == FAILURE) { + return; + } + + szTemp = exif_get_tagname(tag, NULL, 0, tag_table_IFD TSRMLS_CC); + + if (tag < 0 || !szTemp || !szTemp[0]) { + RETURN_FALSE; + } + + RETURN_STRING(szTemp, 1) +} +/* }}} */ + +/* {{{ exif_ifd_make_value + * Create a value for an ifd from an info_data pointer */ +static void* exif_ifd_make_value(image_info_data *info_data, int motorola_intel TSRMLS_DC) { + size_t byte_count; + char *value_ptr, *data_ptr; + size_t i; + + image_info_value *info_value; + + byte_count = php_tiff_bytes_per_format[info_data->format] * info_data->length; + value_ptr = safe_emalloc(max(byte_count, 4), 1, 0); + memset(value_ptr, 0, 4); + if (!info_data->length) { + return value_ptr; + } + if (info_data->format == TAG_FMT_UNDEFINED || info_data->format == TAG_FMT_STRING + || (byte_count>1 && (info_data->format == TAG_FMT_BYTE || info_data->format == TAG_FMT_SBYTE)) + ) { + memmove(value_ptr, info_data->value.s, byte_count); + return value_ptr; + } else if (info_data->format == TAG_FMT_BYTE) { + *value_ptr = info_data->value.u; + return value_ptr; + } else if (info_data->format == TAG_FMT_SBYTE) { + *value_ptr = info_data->value.i; + return value_ptr; + } else { + data_ptr = value_ptr; + for(i=0; i<info_data->length; i++) { + if (info_data->length==1) { + info_value = &info_data->value; + } else { + info_value = &info_data->value.list[i]; + } + switch(info_data->format) { + case TAG_FMT_USHORT: + php_ifd_set16u(data_ptr, info_value->u, motorola_intel); + data_ptr += 2; + break; + case TAG_FMT_ULONG: + php_ifd_set32u(data_ptr, info_value->u, motorola_intel); + data_ptr += 4; + break; + case TAG_FMT_SSHORT: + php_ifd_set16u(data_ptr, info_value->i, motorola_intel); + data_ptr += 2; + break; + case TAG_FMT_SLONG: + php_ifd_set32u(data_ptr, info_value->i, motorola_intel); + data_ptr += 4; + break; + case TAG_FMT_URATIONAL: + php_ifd_set32u(data_ptr, info_value->sr.num, motorola_intel); + php_ifd_set32u(data_ptr+4, info_value->sr.den, motorola_intel); + data_ptr += 8; + break; + case TAG_FMT_SRATIONAL: + php_ifd_set32u(data_ptr, info_value->ur.num, motorola_intel); + php_ifd_set32u(data_ptr+4, info_value->ur.den, motorola_intel); + data_ptr += 8; + break; + case TAG_FMT_SINGLE: + memmove(data_ptr, &info_data->value.f, byte_count); + data_ptr += 4; + break; + case TAG_FMT_DOUBLE: + memmove(data_ptr, &info_data->value.d, byte_count); + data_ptr += 8; + break; + } + } + } + return value_ptr; +} +/* }}} */ + +/* {{{ exif_thumbnail_build + * Check and build thumbnail */ +static void exif_thumbnail_build(image_info_type *ImageInfo TSRMLS_DC) { + size_t new_size, new_move, new_value; + char *new_data; + void *value_ptr; + int i, byte_count; + image_info_list *info_list; + image_info_data *info_data; +#ifdef EXIF_DEBUG + char tagname[64]; +#endif + + if (!ImageInfo->read_thumbnail || !ImageInfo->Thumbnail.offset || !ImageInfo->Thumbnail.size) { + return; /* ignore this call */ + } +#ifdef EXIF_DEBUG + exif_error_docref(NULL EXIFERR_CC, ImageInfo, E_NOTICE, "Thumbnail: filetype = %d", ImageInfo->Thumbnail.filetype); +#endif + switch(ImageInfo->Thumbnail.filetype) { + default: + case IMAGE_FILETYPE_JPEG: + /* done */ + break; + case IMAGE_FILETYPE_TIFF_II: + case IMAGE_FILETYPE_TIFF_MM: + info_list = &ImageInfo->info_list[SECTION_THUMBNAIL]; + new_size = 8 + 2 + info_list->count * 12 + 4; +#ifdef EXIF_DEBUG + exif_error_docref(NULL EXIFERR_CC, ImageInfo, E_NOTICE, "Thumbnail: size of signature + directory(%d): 0x%02X", info_list->count, new_size); +#endif + new_value= new_size; /* offset for ifd values outside ifd directory */ + for (i=0; i<info_list->count; i++) { + info_data = &info_list->list[i]; + byte_count = php_tiff_bytes_per_format[info_data->format] * info_data->length; + if (byte_count > 4) { + new_size += byte_count; + } + } + new_move = new_size; + new_data = safe_erealloc(ImageInfo->Thumbnail.data, 1, ImageInfo->Thumbnail.size, new_size); + ImageInfo->Thumbnail.data = new_data; + memmove(ImageInfo->Thumbnail.data + new_move, ImageInfo->Thumbnail.data, ImageInfo->Thumbnail.size); + ImageInfo->Thumbnail.size += new_size; + /* fill in data */ + if (ImageInfo->motorola_intel) { + memmove(new_data, "MM\x00\x2a\x00\x00\x00\x08", 8); + } else { + memmove(new_data, "II\x2a\x00\x08\x00\x00\x00", 8); + } + new_data += 8; + php_ifd_set16u(new_data, info_list->count, ImageInfo->motorola_intel); + new_data += 2; + for (i=0; i<info_list->count; i++) { + info_data = &info_list->list[i]; + byte_count = php_tiff_bytes_per_format[info_data->format] * info_data->length; +#ifdef EXIF_DEBUG + exif_error_docref(NULL EXIFERR_CC, ImageInfo, E_NOTICE, "Thumbnail: process tag(x%04X=%s): %s%s (%d bytes)", info_data->tag, exif_get_tagname(info_data->tag, tagname, -12, tag_table_IFD TSRMLS_CC), (info_data->length>1)&&info_data->format!=TAG_FMT_UNDEFINED&&info_data->format!=TAG_FMT_STRING?"ARRAY OF ":"", exif_get_tagformat(info_data->format), byte_count); +#endif + if (info_data->tag==TAG_STRIP_OFFSETS || info_data->tag==TAG_JPEG_INTERCHANGE_FORMAT) { + php_ifd_set16u(new_data + 0, info_data->tag, ImageInfo->motorola_intel); + php_ifd_set16u(new_data + 2, TAG_FMT_ULONG, ImageInfo->motorola_intel); + php_ifd_set32u(new_data + 4, 1, ImageInfo->motorola_intel); + php_ifd_set32u(new_data + 8, new_move, ImageInfo->motorola_intel); + } else { + php_ifd_set16u(new_data + 0, info_data->tag, ImageInfo->motorola_intel); + php_ifd_set16u(new_data + 2, info_data->format, ImageInfo->motorola_intel); + php_ifd_set32u(new_data + 4, info_data->length, ImageInfo->motorola_intel); + value_ptr = exif_ifd_make_value(info_data, ImageInfo->motorola_intel TSRMLS_CC); + if (byte_count <= 4) { + memmove(new_data+8, value_ptr, 4); + } else { + php_ifd_set32u(new_data+8, new_value, ImageInfo->motorola_intel); +#ifdef EXIF_DEBUG + exif_error_docref(NULL EXIFERR_CC, ImageInfo, E_NOTICE, "Thumbnail: writing with value offset: 0x%04X + 0x%02X", new_value, byte_count); +#endif + memmove(ImageInfo->Thumbnail.data+new_value, value_ptr, byte_count); + new_value += byte_count; + } + efree(value_ptr); + } + new_data += 12; + } + memset(new_data, 0, 4); /* next ifd pointer */ +#ifdef EXIF_DEBUG + exif_error_docref(NULL EXIFERR_CC, ImageInfo, E_NOTICE, "Thumbnail: created"); +#endif + break; + } +} +/* }}} */ + +/* {{{ exif_thumbnail_extract + * Grab the thumbnail, corrected */ +static void exif_thumbnail_extract(image_info_type *ImageInfo, char *offset, size_t length TSRMLS_DC) { + if (ImageInfo->Thumbnail.data) { + exif_error_docref("exif_read_data#error_mult_thumb" EXIFERR_CC, ImageInfo, E_WARNING, "Multiple possible thumbnails"); + return; /* Should not happen */ + } + if (!ImageInfo->read_thumbnail) { + return; /* ignore this call */ + } + /* according to exif2.1, the thumbnail is not supposed to be greater than 64K */ + if (ImageInfo->Thumbnail.size >= 65536 + || ImageInfo->Thumbnail.size <= 0 + || ImageInfo->Thumbnail.offset <= 0 + ) { + exif_error_docref(NULL EXIFERR_CC, ImageInfo, E_WARNING, "Illegal thumbnail size/offset"); + return; + } + /* Check to make sure we are not going to go past the ExifLength */ + if ((ImageInfo->Thumbnail.offset + ImageInfo->Thumbnail.size) > length) { + EXIF_ERRLOG_THUMBEOF(ImageInfo) + return; + } + ImageInfo->Thumbnail.data = estrndup(offset + ImageInfo->Thumbnail.offset, ImageInfo->Thumbnail.size); + exif_thumbnail_build(ImageInfo TSRMLS_CC); +} +/* }}} */ + +/* {{{ exif_process_undefined + * Copy a string/buffer in Exif header to a character string and return length of allocated buffer if any. */ +static int exif_process_undefined(char **result, char *value, size_t byte_count TSRMLS_DC) { + /* we cannot use strlcpy - here the problem is that we have to copy NUL + * chars up to byte_count, we also have to add a single NUL character to + * force end of string. + * estrndup does not return length + */ + if (byte_count) { + (*result) = estrndup(value, byte_count); /* NULL @ byte_count!!! */ + return byte_count+1; + } + return 0; +} +/* }}} */ + +/* {{{ exif_process_string_raw + * Copy a string in Exif header to a character string returns length of allocated buffer if any. */ +static int exif_process_string_raw(char **result, char *value, size_t byte_count) { + /* we cannot use strlcpy - here the problem is that we have to copy NUL + * chars up to byte_count, we also have to add a single NUL character to + * force end of string. + */ + if (byte_count) { + (*result) = safe_emalloc(byte_count, 1, 1); + memcpy(*result, value, byte_count); + (*result)[byte_count] = '\0'; + return byte_count+1; + } + return 0; +} +/* }}} */ + +/* {{{ exif_process_string + * Copy a string in Exif header to a character string and return length of allocated buffer if any. + * In contrast to exif_process_string this function does allways return a string buffer */ +static int exif_process_string(char **result, char *value, size_t byte_count TSRMLS_DC) { + /* we cannot use strlcpy - here the problem is that we cannot use strlen to + * determin length of string and we cannot use strlcpy with len=byte_count+1 + * because then we might get into an EXCEPTION if we exceed an allocated + * memory page...so we use php_strnlen in conjunction with memcpy and add the NUL + * char. + * estrdup would sometimes allocate more memory and does not return length + */ + if ((byte_count=php_strnlen(value, byte_count)) > 0) { + return exif_process_undefined(result, value, byte_count TSRMLS_CC); + } + (*result) = estrndup("", 1); /* force empty string */ + return byte_count+1; +} +/* }}} */ + +/* {{{ exif_process_user_comment + * Process UserComment in IFD. */ +static int exif_process_user_comment(image_info_type *ImageInfo, char **pszInfoPtr, char **pszEncoding, char *szValuePtr, int ByteCount TSRMLS_DC) +{ + int a; + char *decode; + size_t len;; + + *pszEncoding = NULL; + /* Copy the comment */ + if (ByteCount>=8) { + if (!memcmp(szValuePtr, "UNICODE\0", 8)) { + *pszEncoding = estrdup((const char*)szValuePtr); + szValuePtr = szValuePtr+8; + ByteCount -= 8; + /* First try to detect BOM: ZERO WIDTH NOBREAK SPACE (FEFF 16) + * since we have no encoding support for the BOM yet we skip that. + */ + if (!memcmp(szValuePtr, "\xFE\xFF", 2)) { + decode = "UCS-2BE"; + szValuePtr = szValuePtr+2; + ByteCount -= 2; + } else if (!memcmp(szValuePtr, "\xFF\xFE", 2)) { + decode = "UCS-2LE"; + szValuePtr = szValuePtr+2; + ByteCount -= 2; + } else if (ImageInfo->motorola_intel) { + decode = ImageInfo->decode_unicode_be; + } else { + decode = ImageInfo->decode_unicode_le; + } + if (zend_multibyte_encoding_converter( + (unsigned char**)pszInfoPtr, + &len, + (unsigned char*)szValuePtr, + ByteCount, + zend_multibyte_fetch_encoding(ImageInfo->encode_unicode TSRMLS_CC), + zend_multibyte_fetch_encoding(decode TSRMLS_CC) + TSRMLS_CC) < 0) { + len = exif_process_string_raw(pszInfoPtr, szValuePtr, ByteCount); + } + return len; + } else if (!memcmp(szValuePtr, "ASCII\0\0\0", 8)) { + *pszEncoding = estrdup((const char*)szValuePtr); + szValuePtr = szValuePtr+8; + ByteCount -= 8; + } else if (!memcmp(szValuePtr, "JIS\0\0\0\0\0", 8)) { + /* JIS should be tanslated to MB or we leave it to the user - leave it to the user */ + *pszEncoding = estrdup((const char*)szValuePtr); + szValuePtr = szValuePtr+8; + ByteCount -= 8; + if (zend_multibyte_encoding_converter( + (unsigned char**)pszInfoPtr, + &len, + (unsigned char*)szValuePtr, + ByteCount, + zend_multibyte_fetch_encoding(ImageInfo->encode_jis TSRMLS_CC), + zend_multibyte_fetch_encoding(ImageInfo->motorola_intel ? ImageInfo->decode_jis_be : ImageInfo->decode_jis_le TSRMLS_CC) + TSRMLS_CC) < 0) { + len = exif_process_string_raw(pszInfoPtr, szValuePtr, ByteCount); + } + return len; + } else if (!memcmp(szValuePtr, "\0\0\0\0\0\0\0\0", 8)) { + /* 8 NULL means undefined and should be ASCII... */ + *pszEncoding = estrdup("UNDEFINED"); + szValuePtr = szValuePtr+8; + ByteCount -= 8; + } + } + + /* Olympus has this padded with trailing spaces. Remove these first. */ + if (ByteCount>0) { + for (a=ByteCount-1;a && szValuePtr[a]==' ';a--) { + (szValuePtr)[a] = '\0'; + } + } + + /* normal text without encoding */ + exif_process_string(pszInfoPtr, szValuePtr, ByteCount TSRMLS_CC); + return strlen(*pszInfoPtr); +} +/* }}} */ + +/* {{{ exif_process_unicode + * Process unicode field in IFD. */ +static int exif_process_unicode(image_info_type *ImageInfo, xp_field_type *xp_field, int tag, char *szValuePtr, int ByteCount TSRMLS_DC) +{ + xp_field->tag = tag; + + /* Copy the comment */ + if (zend_multibyte_encoding_converter( + (unsigned char**)&xp_field->value, + &xp_field->size, + (unsigned char*)szValuePtr, + ByteCount, + zend_multibyte_fetch_encoding(ImageInfo->encode_unicode TSRMLS_CC), + zend_multibyte_fetch_encoding(ImageInfo->motorola_intel ? ImageInfo->decode_unicode_be : ImageInfo->decode_unicode_le TSRMLS_CC) + TSRMLS_CC) < 0) { + xp_field->size = exif_process_string_raw(&xp_field->value, szValuePtr, ByteCount); + } + return xp_field->size; +} +/* }}} */ + +/* {{{ exif_process_IFD_in_MAKERNOTE + * Process nested IFDs directories in Maker Note. */ +static int exif_process_IFD_in_MAKERNOTE(image_info_type *ImageInfo, char * value_ptr, int value_len, char *offset_base, size_t IFDlength, size_t displacement TSRMLS_DC) +{ + int de, i=0, section_index = SECTION_MAKERNOTE; + int NumDirEntries, old_motorola_intel, offset_diff; + const maker_note_type *maker_note; + char *dir_start; + + for (i=0; i<=sizeof(maker_note_array)/sizeof(maker_note_type); i++) { + if (i==sizeof(maker_note_array)/sizeof(maker_note_type)) + return FALSE; + maker_note = maker_note_array+i; + + /*exif_error_docref(NULL EXIFERR_CC, ImageInfo, E_NOTICE, "check (%s,%s)", maker_note->make?maker_note->make:"", maker_note->model?maker_note->model:"");*/ + if (maker_note->make && (!ImageInfo->make || strcmp(maker_note->make, ImageInfo->make))) + continue; + if (maker_note->model && (!ImageInfo->model || strcmp(maker_note->model, ImageInfo->model))) + continue; + if (maker_note->id_string && strncmp(maker_note->id_string, value_ptr, maker_note->id_string_len)) + continue; + break; + } + + dir_start = value_ptr + maker_note->offset; + +#ifdef EXIF_DEBUG + exif_error_docref(NULL EXIFERR_CC, ImageInfo, E_NOTICE, "Process %s @x%04X + 0x%04X=%d: %s", exif_get_sectionname(section_index), (int)dir_start-(int)offset_base+maker_note->offset+displacement, value_len, value_len, exif_char_dump(value_ptr, value_len, (int)dir_start-(int)offset_base+maker_note->offset+displacement)); +#endif + + ImageInfo->sections_found |= FOUND_MAKERNOTE; + + old_motorola_intel = ImageInfo->motorola_intel; + switch (maker_note->byte_order) { + case MN_ORDER_INTEL: + ImageInfo->motorola_intel = 0; + break; + case MN_ORDER_MOTOROLA: + ImageInfo->motorola_intel = 1; + break; + default: + case MN_ORDER_NORMAL: + break; + } + + NumDirEntries = php_ifd_get16u(dir_start, ImageInfo->motorola_intel); + + switch (maker_note->offset_mode) { + case MN_OFFSET_MAKER: + offset_base = value_ptr; + break; + case MN_OFFSET_GUESS: + offset_diff = 2 + NumDirEntries*12 + 4 - php_ifd_get32u(dir_start+10, ImageInfo->motorola_intel); +#ifdef EXIF_DEBUG + exif_error_docref(NULL EXIFERR_CC, ImageInfo, E_NOTICE, "Using automatic offset correction: 0x%04X", ((int)dir_start-(int)offset_base+maker_note->offset+displacement) + offset_diff); +#endif + offset_base = value_ptr + offset_diff; + break; + default: + case MN_OFFSET_NORMAL: + break; + } + + if ((2+NumDirEntries*12) > value_len) { + exif_error_docref("exif_read_data#error_ifd" EXIFERR_CC, ImageInfo, E_WARNING, "Illegal IFD size: 2 + x%04X*12 = x%04X > x%04X", NumDirEntries, 2+NumDirEntries*12, value_len); + return FALSE; + } + + for (de=0;de<NumDirEntries;de++) { + if (!exif_process_IFD_TAG(ImageInfo, dir_start + 2 + 12 * de, + offset_base, IFDlength, displacement, section_index, 0, maker_note->tag_table TSRMLS_CC)) { + return FALSE; + } + } + ImageInfo->motorola_intel = old_motorola_intel; +/* NextDirOffset (must be NULL) = php_ifd_get32u(dir_start+2+12*de, ImageInfo->motorola_intel);*/ +#ifdef EXIF_DEBUG + exif_error_docref(NULL EXIFERR_CC, ImageInfo, E_NOTICE, "Subsection %s done", exif_get_sectionname(SECTION_MAKERNOTE)); +#endif + return TRUE; +} +/* }}} */ + +/* {{{ exif_process_IFD_TAG + * Process one of the nested IFDs directories. */ +static int exif_process_IFD_TAG(image_info_type *ImageInfo, char *dir_entry, char *offset_base, size_t IFDlength, size_t displacement, int section_index, int ReadNextIFD, tag_table_type tag_table TSRMLS_DC) +{ + size_t length; + int tag, format, components; + char *value_ptr, tagname[64], cbuf[32], *outside=NULL; + size_t byte_count, offset_val, fpos, fgot; + int64_t byte_count_signed; + xp_field_type *tmp_xp; +#ifdef EXIF_DEBUG + char *dump_data; + int dump_free; +#endif /* EXIF_DEBUG */ + + /* Protect against corrupt headers */ + if (ImageInfo->ifd_nesting_level > MAX_IFD_NESTING_LEVEL) { + exif_error_docref("exif_read_data#error_ifd" EXIFERR_CC, ImageInfo, E_WARNING, "corrupt EXIF header: maximum directory nesting level reached"); + return FALSE; + } + ImageInfo->ifd_nesting_level++; + + tag = php_ifd_get16u(dir_entry, ImageInfo->motorola_intel); + format = php_ifd_get16u(dir_entry+2, ImageInfo->motorola_intel); + components = php_ifd_get32u(dir_entry+4, ImageInfo->motorola_intel); + + if (!format || format > NUM_FORMATS) { + /* (-1) catches illegal zero case as unsigned underflows to positive large. */ + exif_error_docref("exif_read_data#error_ifd" EXIFERR_CC, ImageInfo, E_WARNING, "Process tag(x%04X=%s): Illegal format code 0x%04X, suppose BYTE", tag, exif_get_tagname(tag, tagname, -12, tag_table TSRMLS_CC), format); + format = TAG_FMT_BYTE; + /*return TRUE;*/ + } + + if (components < 0) { + exif_error_docref("exif_read_data#error_ifd" EXIFERR_CC, ImageInfo, E_WARNING, "Process tag(x%04X=%s): Illegal components(%ld)", tag, exif_get_tagname(tag, tagname, -12, tag_table TSRMLS_CC), components); + return FALSE; + } + + byte_count_signed = (int64_t)components * php_tiff_bytes_per_format[format]; + + if (byte_count_signed < 0 || (byte_count_signed > INT32_MAX)) { + exif_error_docref("exif_read_data#error_ifd" EXIFERR_CC, ImageInfo, E_WARNING, "Process tag(x%04X=%s): Illegal byte_count", tag, exif_get_tagname(tag, tagname, -12, tag_table TSRMLS_CC)); + return FALSE; + } + + byte_count = (size_t)byte_count_signed; + + if (byte_count > 4) { + offset_val = php_ifd_get32u(dir_entry+8, ImageInfo->motorola_intel); + /* If its bigger than 4 bytes, the dir entry contains an offset. */ + value_ptr = offset_base+offset_val; + if (byte_count > IFDlength || offset_val > IFDlength-byte_count || value_ptr < dir_entry) { + /* It is important to check for IMAGE_FILETYPE_TIFF + * JPEG does not use absolute pointers instead its pointers are + * relative to the start of the TIFF header in APP1 section. */ + if (byte_count > ImageInfo->FileSize || offset_val>ImageInfo->FileSize-byte_count || (ImageInfo->FileType!=IMAGE_FILETYPE_TIFF_II && ImageInfo->FileType!=IMAGE_FILETYPE_TIFF_MM && ImageInfo->FileType!=IMAGE_FILETYPE_JPEG)) { + if (value_ptr < dir_entry) { + /* we can read this if offset_val > 0 */ + /* some files have their values in other parts of the file */ + exif_error_docref("exif_read_data#error_ifd" EXIFERR_CC, ImageInfo, E_WARNING, "Process tag(x%04X=%s): Illegal pointer offset(x%04X < x%04X)", tag, exif_get_tagname(tag, tagname, -12, tag_table TSRMLS_CC), offset_val, dir_entry); + } else { + /* this is for sure not allowed */ + /* exception are IFD pointers */ + exif_error_docref("exif_read_data#error_ifd" EXIFERR_CC, ImageInfo, E_WARNING, "Process tag(x%04X=%s): Illegal pointer offset(x%04X + x%04X = x%04X > x%04X)", tag, exif_get_tagname(tag, tagname, -12, tag_table TSRMLS_CC), offset_val, byte_count, offset_val+byte_count, IFDlength); + } + return FALSE; + } + if (byte_count>sizeof(cbuf)) { + /* mark as outside range and get buffer */ + value_ptr = safe_emalloc(byte_count, 1, 0); + outside = value_ptr; + } else { + /* In most cases we only access a small range so + * it is faster to use a static buffer there + * BUT it offers also the possibility to have + * pointers read without the need to free them + * explicitley before returning. */ + memset(&cbuf, 0, sizeof(cbuf)); + value_ptr = cbuf; + } + + fpos = php_stream_tell(ImageInfo->infile); + php_stream_seek(ImageInfo->infile, offset_val, SEEK_SET); + fgot = php_stream_tell(ImageInfo->infile); + if (fgot!=offset_val) { + EFREE_IF(outside); + exif_error_docref(NULL EXIFERR_CC, ImageInfo, E_WARNING, "Wrong file pointer: 0x%08X != 0x%08X", fgot, offset_val); + return FALSE; + } + fgot = php_stream_read(ImageInfo->infile, value_ptr, byte_count); + php_stream_seek(ImageInfo->infile, fpos, SEEK_SET); + if (fgot<byte_count) { + EFREE_IF(outside); + EXIF_ERRLOG_FILEEOF(ImageInfo) + return FALSE; + } + } + } else { + /* 4 bytes or less and value is in the dir entry itself */ + value_ptr = dir_entry+8; + offset_val= value_ptr-offset_base; + } + + ImageInfo->sections_found |= FOUND_ANY_TAG; +#ifdef EXIF_DEBUG + dump_data = exif_dump_data(&dump_free, format, components, length, ImageInfo->motorola_intel, value_ptr TSRMLS_CC); + exif_error_docref(NULL EXIFERR_CC, ImageInfo, E_NOTICE, "Process tag(x%04X=%s,@x%04X + x%04X(=%d)): %s%s %s", tag, exif_get_tagname(tag, tagname, -12, tag_table TSRMLS_CC), offset_val+displacement, byte_count, byte_count, (components>1)&&format!=TAG_FMT_UNDEFINED&&format!=TAG_FMT_STRING?"ARRAY OF ":"", exif_get_tagformat(format), dump_data); + if (dump_free) { + efree(dump_data); + } +#endif + + if (section_index==SECTION_THUMBNAIL) { + if (!ImageInfo->Thumbnail.data) { + switch(tag) { + case TAG_IMAGEWIDTH: + case TAG_COMP_IMAGE_WIDTH: + ImageInfo->Thumbnail.width = exif_convert_any_to_int(value_ptr, format, ImageInfo->motorola_intel TSRMLS_CC); + break; + + case TAG_IMAGEHEIGHT: + case TAG_COMP_IMAGE_HEIGHT: + ImageInfo->Thumbnail.height = exif_convert_any_to_int(value_ptr, format, ImageInfo->motorola_intel TSRMLS_CC); + break; + + case TAG_STRIP_OFFSETS: + case TAG_JPEG_INTERCHANGE_FORMAT: + /* accept both formats */ + ImageInfo->Thumbnail.offset = exif_convert_any_to_int(value_ptr, format, ImageInfo->motorola_intel TSRMLS_CC); + break; + + case TAG_STRIP_BYTE_COUNTS: + if (ImageInfo->FileType == IMAGE_FILETYPE_TIFF_II || ImageInfo->FileType == IMAGE_FILETYPE_TIFF_MM) { + ImageInfo->Thumbnail.filetype = ImageInfo->FileType; + } else { + /* motorola is easier to read */ + ImageInfo->Thumbnail.filetype = IMAGE_FILETYPE_TIFF_MM; + } + ImageInfo->Thumbnail.size = exif_convert_any_to_int(value_ptr, format, ImageInfo->motorola_intel TSRMLS_CC); + break; + + case TAG_JPEG_INTERCHANGE_FORMAT_LEN: + if (ImageInfo->Thumbnail.filetype == IMAGE_FILETYPE_UNKNOWN) { + ImageInfo->Thumbnail.filetype = IMAGE_FILETYPE_JPEG; + ImageInfo->Thumbnail.size = exif_convert_any_to_int(value_ptr, format, ImageInfo->motorola_intel TSRMLS_CC); + } + break; + } + } + } else { + if (section_index==SECTION_IFD0 || section_index==SECTION_EXIF) + switch(tag) { + case TAG_COPYRIGHT: + /* check for "<photographer> NUL <editor> NUL" */ + if (byte_count>1 && (length=php_strnlen(value_ptr, byte_count)) > 0) { + if (length<byte_count-1) { + /* When there are any characters after the first NUL */ + ImageInfo->CopyrightPhotographer = estrdup(value_ptr); + ImageInfo->CopyrightEditor = estrdup(value_ptr+length+1); + spprintf(&ImageInfo->Copyright, 0, "%s, %s", value_ptr, value_ptr+length+1); + /* format = TAG_FMT_UNDEFINED; this musn't be ASCII */ + /* but we are not supposed to change this */ + /* keep in mind that image_info does not store editor value */ + } else { + ImageInfo->Copyright = estrdup(value_ptr); + } + } + break; + + case TAG_USERCOMMENT: + ImageInfo->UserCommentLength = exif_process_user_comment(ImageInfo, &(ImageInfo->UserComment), &(ImageInfo->UserCommentEncoding), value_ptr, byte_count TSRMLS_CC); + break; + + case TAG_XP_TITLE: + case TAG_XP_COMMENTS: + case TAG_XP_AUTHOR: + case TAG_XP_KEYWORDS: + case TAG_XP_SUBJECT: + tmp_xp = (xp_field_type*)safe_erealloc(ImageInfo->xp_fields.list, (ImageInfo->xp_fields.count+1), sizeof(xp_field_type), 0); + ImageInfo->sections_found |= FOUND_WINXP; + ImageInfo->xp_fields.list = tmp_xp; + ImageInfo->xp_fields.count++; + exif_process_unicode(ImageInfo, &(ImageInfo->xp_fields.list[ImageInfo->xp_fields.count-1]), tag, value_ptr, byte_count TSRMLS_CC); + break; + + case TAG_FNUMBER: + /* Simplest way of expressing aperture, so I trust it the most. + (overwrite previously computed value if there is one) */ + ImageInfo->ApertureFNumber = (float)exif_convert_any_format(value_ptr, format, ImageInfo->motorola_intel TSRMLS_CC); + break; + + case TAG_APERTURE: + case TAG_MAX_APERTURE: + /* More relevant info always comes earlier, so only use this field if we don't + have appropriate aperture information yet. */ + if (ImageInfo->ApertureFNumber == 0) { + ImageInfo->ApertureFNumber + = (float)exp(exif_convert_any_format(value_ptr, format, ImageInfo->motorola_intel TSRMLS_CC)*log(2)*0.5); + } + break; + + case TAG_SHUTTERSPEED: + /* More complicated way of expressing exposure time, so only use + this value if we don't already have it from somewhere else. + SHUTTERSPEED comes after EXPOSURE TIME + */ + if (ImageInfo->ExposureTime == 0) { + ImageInfo->ExposureTime + = (float)(1/exp(exif_convert_any_format(value_ptr, format, ImageInfo->motorola_intel TSRMLS_CC)*log(2))); + } + break; + case TAG_EXPOSURETIME: + ImageInfo->ExposureTime = -1; + break; + + case TAG_COMP_IMAGE_WIDTH: + ImageInfo->ExifImageWidth = exif_convert_any_to_int(value_ptr, format, ImageInfo->motorola_intel TSRMLS_CC); + break; + + case TAG_FOCALPLANE_X_RES: + ImageInfo->FocalplaneXRes = exif_convert_any_format(value_ptr, format, ImageInfo->motorola_intel TSRMLS_CC); + break; + + case TAG_SUBJECT_DISTANCE: + /* Inidcates the distacne the autofocus camera is focused to. + Tends to be less accurate as distance increases. */ + ImageInfo->Distance = (float)exif_convert_any_format(value_ptr, format, ImageInfo->motorola_intel TSRMLS_CC); + break; + + case TAG_FOCALPLANE_RESOLUTION_UNIT: + switch((int)exif_convert_any_format(value_ptr, format, ImageInfo->motorola_intel TSRMLS_CC)) { + case 1: ImageInfo->FocalplaneUnits = 25.4; break; /* inch */ + case 2: + /* According to the information I was using, 2 measn meters. + But looking at the Cannon powershot's files, inches is the only + sensible value. */ + ImageInfo->FocalplaneUnits = 25.4; + break; + + case 3: ImageInfo->FocalplaneUnits = 10; break; /* centimeter */ + case 4: ImageInfo->FocalplaneUnits = 1; break; /* milimeter */ + case 5: ImageInfo->FocalplaneUnits = .001; break; /* micrometer */ + } + break; + + case TAG_SUB_IFD: + if (format==TAG_FMT_IFD) { + /* If this is called we are either in a TIFFs thumbnail or a JPEG where we cannot handle it */ + /* TIFF thumbnail: our data structure cannot store a thumbnail of a thumbnail */ + /* JPEG do we have the data area and what to do with it */ + exif_error_docref(NULL EXIFERR_CC, ImageInfo, E_NOTICE, "Skip SUB IFD"); + } + break; + + case TAG_MAKE: + ImageInfo->make = estrdup(value_ptr); + break; + case TAG_MODEL: + ImageInfo->model = estrdup(value_ptr); + break; + + case TAG_MAKER_NOTE: + exif_process_IFD_in_MAKERNOTE(ImageInfo, value_ptr, byte_count, offset_base, IFDlength, displacement TSRMLS_CC); + break; + + case TAG_EXIF_IFD_POINTER: + case TAG_GPS_IFD_POINTER: + case TAG_INTEROP_IFD_POINTER: + if (ReadNextIFD) { + char *Subdir_start; + int sub_section_index = 0; + switch(tag) { + case TAG_EXIF_IFD_POINTER: +#ifdef EXIF_DEBUG + exif_error_docref(NULL EXIFERR_CC, ImageInfo, E_NOTICE, "Found EXIF"); +#endif + ImageInfo->sections_found |= FOUND_EXIF; + sub_section_index = SECTION_EXIF; + break; + case TAG_GPS_IFD_POINTER: +#ifdef EXIF_DEBUG + exif_error_docref(NULL EXIFERR_CC, ImageInfo, E_NOTICE, "Found GPS"); +#endif + ImageInfo->sections_found |= FOUND_GPS; + sub_section_index = SECTION_GPS; + break; + case TAG_INTEROP_IFD_POINTER: +#ifdef EXIF_DEBUG + exif_error_docref(NULL EXIFERR_CC, ImageInfo, E_NOTICE, "Found INTEROPERABILITY"); +#endif + ImageInfo->sections_found |= FOUND_INTEROP; + sub_section_index = SECTION_INTEROP; + break; + } + Subdir_start = offset_base + php_ifd_get32u(value_ptr, ImageInfo->motorola_intel); + if (Subdir_start < offset_base || Subdir_start > offset_base+IFDlength) { + exif_error_docref("exif_read_data#error_ifd" EXIFERR_CC, ImageInfo, E_WARNING, "Illegal IFD Pointer"); + return FALSE; + } + if (!exif_process_IFD_in_JPEG(ImageInfo, Subdir_start, offset_base, IFDlength, displacement, sub_section_index TSRMLS_CC)) { + return FALSE; + } +#ifdef EXIF_DEBUG + exif_error_docref(NULL EXIFERR_CC, ImageInfo, E_NOTICE, "Subsection %s done", exif_get_sectionname(sub_section_index)); +#endif + } + } + } + exif_iif_add_tag(ImageInfo, section_index, exif_get_tagname(tag, tagname, sizeof(tagname), tag_table TSRMLS_CC), tag, format, components, value_ptr TSRMLS_CC); + EFREE_IF(outside); + return TRUE; +} +/* }}} */ + +/* {{{ exif_process_IFD_in_JPEG + * Process one of the nested IFDs directories. */ +static int exif_process_IFD_in_JPEG(image_info_type *ImageInfo, char *dir_start, char *offset_base, size_t IFDlength, size_t displacement, int section_index TSRMLS_DC) +{ + int de; + int NumDirEntries; + int NextDirOffset; + +#ifdef EXIF_DEBUG + exif_error_docref(NULL EXIFERR_CC, ImageInfo, E_NOTICE, "Process %s (x%04X(=%d))", exif_get_sectionname(section_index), IFDlength, IFDlength); +#endif + + ImageInfo->sections_found |= FOUND_IFD0; + + NumDirEntries = php_ifd_get16u(dir_start, ImageInfo->motorola_intel); + + if ((dir_start+2+NumDirEntries*12) > (offset_base+IFDlength)) { + exif_error_docref("exif_read_data#error_ifd" EXIFERR_CC, ImageInfo, E_WARNING, "Illegal IFD size: x%04X + 2 + x%04X*12 = x%04X > x%04X", (int)((size_t)dir_start+2-(size_t)offset_base), NumDirEntries, (int)((size_t)dir_start+2+NumDirEntries*12-(size_t)offset_base), IFDlength); + return FALSE; + } + + for (de=0;de<NumDirEntries;de++) { + if (!exif_process_IFD_TAG(ImageInfo, dir_start + 2 + 12 * de, + offset_base, IFDlength, displacement, section_index, 1, exif_get_tag_table(section_index) TSRMLS_CC)) { + return FALSE; + } + } + /* + * Ignore IFD2 if it purportedly exists + */ + if (section_index == SECTION_THUMBNAIL) { + return TRUE; + } + /* + * Hack to make it process IDF1 I hope + * There are 2 IDFs, the second one holds the keys (0x0201 and 0x0202) to the thumbnail + */ + NextDirOffset = php_ifd_get32u(dir_start+2+12*de, ImageInfo->motorola_intel); + if (NextDirOffset) { + /* the next line seems false but here IFDlength means length of all IFDs */ + if (offset_base + NextDirOffset < offset_base || offset_base + NextDirOffset > offset_base+IFDlength) { + exif_error_docref("exif_read_data#error_ifd" EXIFERR_CC, ImageInfo, E_WARNING, "Illegal IFD offset"); + return FALSE; + } + /* That is the IFD for the first thumbnail */ +#ifdef EXIF_DEBUG + exif_error_docref(NULL EXIFERR_CC, ImageInfo, E_NOTICE, "Expect next IFD to be thumbnail"); +#endif + if (exif_process_IFD_in_JPEG(ImageInfo, offset_base + NextDirOffset, offset_base, IFDlength, displacement, SECTION_THUMBNAIL TSRMLS_CC)) { +#ifdef EXIF_DEBUG + exif_error_docref(NULL EXIFERR_CC, ImageInfo, E_NOTICE, "Thumbnail size: 0x%04X", ImageInfo->Thumbnail.size); +#endif + if (ImageInfo->Thumbnail.filetype != IMAGE_FILETYPE_UNKNOWN + && ImageInfo->Thumbnail.size + && ImageInfo->Thumbnail.offset + && ImageInfo->read_thumbnail + ) { + exif_thumbnail_extract(ImageInfo, offset_base, IFDlength TSRMLS_CC); + } + return TRUE; + } else { + return FALSE; + } + } + return TRUE; +} +/* }}} */ + +/* {{{ exif_process_TIFF_in_JPEG + Process a TIFF header in a JPEG file +*/ +static void exif_process_TIFF_in_JPEG(image_info_type *ImageInfo, char *CharBuf, size_t length, size_t displacement TSRMLS_DC) +{ + unsigned exif_value_2a, offset_of_ifd; + + /* set the thumbnail stuff to nothing so we can test to see if they get set up */ + if (memcmp(CharBuf, "II", 2) == 0) { + ImageInfo->motorola_intel = 0; + } else if (memcmp(CharBuf, "MM", 2) == 0) { + ImageInfo->motorola_intel = 1; + } else { + exif_error_docref(NULL EXIFERR_CC, ImageInfo, E_WARNING, "Invalid TIFF alignment marker"); + return; + } + + /* Check the next two values for correctness. */ + exif_value_2a = php_ifd_get16u(CharBuf+2, ImageInfo->motorola_intel); + offset_of_ifd = php_ifd_get32u(CharBuf+4, ImageInfo->motorola_intel); + if ( exif_value_2a != 0x2a || offset_of_ifd < 0x08) { + exif_error_docref(NULL EXIFERR_CC, ImageInfo, E_WARNING, "Invalid TIFF start (1)"); + return; + } + if (offset_of_ifd > length) { + exif_error_docref(NULL EXIFERR_CC, ImageInfo, E_WARNING, "Invalid IFD start"); + return; + } + + ImageInfo->sections_found |= FOUND_IFD0; + /* First directory starts at offset 8. Offsets starts at 0. */ + exif_process_IFD_in_JPEG(ImageInfo, CharBuf+offset_of_ifd, CharBuf, length/*-14*/, displacement, SECTION_IFD0 TSRMLS_CC); + +#ifdef EXIF_DEBUG + exif_error_docref(NULL EXIFERR_CC, ImageInfo, E_NOTICE, "Process TIFF in JPEG done"); +#endif + + /* Compute the CCD width, in milimeters. */ + if (ImageInfo->FocalplaneXRes != 0) { + ImageInfo->CCDWidth = (float)(ImageInfo->ExifImageWidth * ImageInfo->FocalplaneUnits / ImageInfo->FocalplaneXRes); + } +} +/* }}} */ + +/* {{{ exif_process_APP1 + Process an JPEG APP1 block marker + Describes all the drivel that most digital cameras include... +*/ +static void exif_process_APP1(image_info_type *ImageInfo, char *CharBuf, size_t length, size_t displacement TSRMLS_DC) +{ + /* Check the APP1 for Exif Identifier Code */ + static const uchar ExifHeader[] = {0x45, 0x78, 0x69, 0x66, 0x00, 0x00}; + if (length <= 8 || memcmp(CharBuf+2, ExifHeader, 6)) { + exif_error_docref(NULL EXIFERR_CC, ImageInfo, E_WARNING, "Incorrect APP1 Exif Identifier Code"); + return; + } + exif_process_TIFF_in_JPEG(ImageInfo, CharBuf + 8, length - 8, displacement+8 TSRMLS_CC); +#ifdef EXIF_DEBUG + exif_error_docref(NULL EXIFERR_CC, ImageInfo, E_NOTICE, "Process APP1/EXIF done"); +#endif +} +/* }}} */ + +/* {{{ exif_process_APP12 + Process an JPEG APP12 block marker used by OLYMPUS +*/ +static void exif_process_APP12(image_info_type *ImageInfo, char *buffer, size_t length TSRMLS_DC) +{ + size_t l1, l2=0; + + if ((l1 = php_strnlen(buffer+2, length-2)) > 0) { + exif_iif_add_tag(ImageInfo, SECTION_APP12, "Company", TAG_NONE, TAG_FMT_STRING, l1, buffer+2 TSRMLS_CC); + if (length > 2+l1+1) { + l2 = php_strnlen(buffer+2+l1+1, length-2-l1-1); + exif_iif_add_tag(ImageInfo, SECTION_APP12, "Info", TAG_NONE, TAG_FMT_STRING, l2, buffer+2+l1+1 TSRMLS_CC); + } + } +#ifdef EXIF_DEBUG + exif_error_docref(NULL EXIFERR_CC, ImageInfo, E_NOTICE, "Process section APP12 with l1=%d, l2=%d done", l1, l2); +#endif +} +/* }}} */ + +/* {{{ exif_scan_JPEG_header + * Parse the marker stream until SOS or EOI is seen; */ +static int exif_scan_JPEG_header(image_info_type *ImageInfo TSRMLS_DC) +{ + int section, sn; + int marker = 0, last_marker = M_PSEUDO, comment_correction=1; + unsigned int ll, lh; + uchar *Data; + size_t fpos, size, got, itemlen; + jpeg_sof_info sof_info; + + for(section=0;;section++) { +#ifdef EXIF_DEBUG + fpos = php_stream_tell(ImageInfo->infile); + exif_error_docref(NULL EXIFERR_CC, ImageInfo, E_NOTICE, "Needing section %d @ 0x%08X", ImageInfo->file.count, fpos); +#endif + + /* get marker byte, swallowing possible padding */ + /* some software does not count the length bytes of COM section */ + /* one company doing so is very much envolved in JPEG... so we accept too */ + if (last_marker==M_COM && comment_correction) { + comment_correction = 2; + } + do { + if ((marker = php_stream_getc(ImageInfo->infile)) == EOF) { + EXIF_ERRLOG_CORRUPT(ImageInfo) + return FALSE; + } + if (last_marker==M_COM && comment_correction>0) { + if (marker!=0xFF) { + marker = 0xff; + comment_correction--; + } else { + last_marker = M_PSEUDO; /* stop skipping 0 for M_COM */ + } + } + } while (marker == 0xff); + if (last_marker==M_COM && !comment_correction) { + exif_error_docref("exif_read_data#error_mcom" EXIFERR_CC, ImageInfo, E_NOTICE, "Image has corrupt COM section: some software set wrong length information"); + } + if (last_marker==M_COM && comment_correction) + return M_EOI; /* ah illegal: char after COM section not 0xFF */ + + fpos = php_stream_tell(ImageInfo->infile); + + if (marker == 0xff) { + /* 0xff is legal padding, but if we get that many, something's wrong. */ + exif_error_docref(NULL EXIFERR_CC, ImageInfo, E_WARNING, "To many padding bytes"); + return FALSE; + } + + /* Read the length of the section. */ + if ((lh = php_stream_getc(ImageInfo->infile)) == EOF) { + EXIF_ERRLOG_CORRUPT(ImageInfo) + return FALSE; + } + if ((ll = php_stream_getc(ImageInfo->infile)) == EOF) { + EXIF_ERRLOG_CORRUPT(ImageInfo) + return FALSE; + } + + itemlen = (lh << 8) | ll; + + if (itemlen < 2) { +#ifdef EXIF_DEBUG + exif_error_docref(NULL EXIFERR_CC, ImageInfo, E_WARNING, "%s, Section length: 0x%02X%02X", EXIF_ERROR_CORRUPT, lh, ll); +#else + EXIF_ERRLOG_CORRUPT(ImageInfo) +#endif + return FALSE; + } + + sn = exif_file_sections_add(ImageInfo, marker, itemlen+1, NULL); + Data = ImageInfo->file.list[sn].data; + + /* Store first two pre-read bytes. */ + Data[0] = (uchar)lh; + Data[1] = (uchar)ll; + + got = php_stream_read(ImageInfo->infile, (char*)(Data+2), itemlen-2); /* Read the whole section. */ + if (got != itemlen-2) { + exif_error_docref(NULL EXIFERR_CC, ImageInfo, E_WARNING, "Error reading from file: got=x%04X(=%d) != itemlen-2=x%04X(=%d)", got, got, itemlen-2, itemlen-2); + return FALSE; + } + +#ifdef EXIF_DEBUG + exif_error_docref(NULL EXIFERR_CC, ImageInfo, E_NOTICE, "Process section(x%02X=%s) @ x%04X + x%04X(=%d)", marker, exif_get_markername(marker), fpos, itemlen, itemlen); +#endif + switch(marker) { + case M_SOS: /* stop before hitting compressed data */ + /* If reading entire image is requested, read the rest of the data. */ + if (ImageInfo->read_all) { + /* Determine how much file is left. */ + fpos = php_stream_tell(ImageInfo->infile); + size = ImageInfo->FileSize - fpos; + sn = exif_file_sections_add(ImageInfo, M_PSEUDO, size, NULL); + Data = ImageInfo->file.list[sn].data; + got = php_stream_read(ImageInfo->infile, (char*)Data, size); + if (got != size) { + EXIF_ERRLOG_FILEEOF(ImageInfo) + return FALSE; + } + } + return TRUE; + + case M_EOI: /* in case it's a tables-only JPEG stream */ + exif_error_docref(NULL EXIFERR_CC, ImageInfo, E_WARNING, "No image in jpeg!"); + return (ImageInfo->sections_found&(~FOUND_COMPUTED)) ? TRUE : FALSE; + + case M_COM: /* Comment section */ + exif_process_COM(ImageInfo, (char *)Data, itemlen TSRMLS_CC); + break; + + case M_EXIF: + if (!(ImageInfo->sections_found&FOUND_IFD0)) { + /*ImageInfo->sections_found |= FOUND_EXIF;*/ + /* Seen files from some 'U-lead' software with Vivitar scanner + that uses marker 31 later in the file (no clue what for!) */ + exif_process_APP1(ImageInfo, (char *)Data, itemlen, fpos TSRMLS_CC); + } + break; + + case M_APP12: + exif_process_APP12(ImageInfo, (char *)Data, itemlen TSRMLS_CC); + break; + + + case M_SOF0: + case M_SOF1: + case M_SOF2: + case M_SOF3: + case M_SOF5: + case M_SOF6: + case M_SOF7: + case M_SOF9: + case M_SOF10: + case M_SOF11: + case M_SOF13: + case M_SOF14: + case M_SOF15: + if ((itemlen - 2) < 6) { + return FALSE; + } + + exif_process_SOFn(Data, marker, &sof_info); + ImageInfo->Width = sof_info.width; + ImageInfo->Height = sof_info.height; + if (sof_info.num_components == 3) { + ImageInfo->IsColor = 1; + } else { + ImageInfo->IsColor = 0; + } + break; + default: + /* skip any other marker silently. */ + break; + } + + /* keep track of last marker */ + last_marker = marker; + } +#ifdef EXIF_DEBUG + exif_error_docref(NULL EXIFERR_CC, ImageInfo, E_NOTICE, "Done"); +#endif + return TRUE; +} +/* }}} */ + +/* {{{ exif_scan_thumbnail + * scan JPEG in thumbnail (memory) */ +static int exif_scan_thumbnail(image_info_type *ImageInfo TSRMLS_DC) +{ + uchar c, *data = (uchar*)ImageInfo->Thumbnail.data; + int n, marker; + size_t length=2, pos=0; + jpeg_sof_info sof_info; + + if (!data) { + return FALSE; /* nothing to do here */ + } + if (memcmp(data, "\xFF\xD8\xFF", 3)) { + if (!ImageInfo->Thumbnail.width && !ImageInfo->Thumbnail.height) { + exif_error_docref(NULL EXIFERR_CC, ImageInfo, E_WARNING, "Thumbnail is not a JPEG image"); + } + return FALSE; + } + for (;;) { + pos += length; + if (pos>=ImageInfo->Thumbnail.size) + return FALSE; + c = data[pos++]; + if (pos>=ImageInfo->Thumbnail.size) + return FALSE; + if (c != 0xFF) { + return FALSE; + } + n = 8; + while ((c = data[pos++]) == 0xFF && n--) { + if (pos+3>=ImageInfo->Thumbnail.size) + return FALSE; + /* +3 = pos++ of next check when reaching marker + 2 bytes for length */ + } + if (c == 0xFF) + return FALSE; + marker = c; + length = php_jpg_get16(data+pos); + if (pos+length>=ImageInfo->Thumbnail.size) { + return FALSE; + } +#ifdef EXIF_DEBUG + exif_error_docref(NULL EXIFERR_CC, ImageInfo, E_NOTICE, "Thumbnail: process section(x%02X=%s) @ x%04X + x%04X", marker, exif_get_markername(marker), pos, length); +#endif + switch (marker) { + case M_SOF0: + case M_SOF1: + case M_SOF2: + case M_SOF3: + case M_SOF5: + case M_SOF6: + case M_SOF7: + case M_SOF9: + case M_SOF10: + case M_SOF11: + case M_SOF13: + case M_SOF14: + case M_SOF15: + /* handle SOFn block */ + exif_process_SOFn(data+pos, marker, &sof_info); + ImageInfo->Thumbnail.height = sof_info.height; + ImageInfo->Thumbnail.width = sof_info.width; +#ifdef EXIF_DEBUG + exif_error_docref(NULL EXIFERR_CC, ImageInfo, E_NOTICE, "Thumbnail: size: %d * %d", sof_info.width, sof_info.height); +#endif + return TRUE; + + case M_SOS: + case M_EOI: + exif_error_docref(NULL EXIFERR_CC, ImageInfo, E_WARNING, "Could not compute size of thumbnail"); + return FALSE; + break; + + default: + /* just skip */ + break; + } + } + + exif_error_docref(NULL EXIFERR_CC, ImageInfo, E_WARNING, "Could not compute size of thumbnail"); + return FALSE; +} +/* }}} */ + +/* {{{ exif_process_IFD_in_TIFF + * Parse the TIFF header; */ +static int exif_process_IFD_in_TIFF(image_info_type *ImageInfo, size_t dir_offset, int section_index TSRMLS_DC) +{ + int i, sn, num_entries, sub_section_index = 0; + unsigned char *dir_entry; + char tagname[64]; + size_t ifd_size, dir_size, entry_offset, next_offset, entry_length, entry_value=0, fgot; + int entry_tag , entry_type; + tag_table_type tag_table = exif_get_tag_table(section_index); + + if (ImageInfo->ifd_nesting_level > MAX_IFD_NESTING_LEVEL) { + return FALSE; + } + + if (ImageInfo->FileSize >= dir_offset+2) { + sn = exif_file_sections_add(ImageInfo, M_PSEUDO, 2, NULL); +#ifdef EXIF_DEBUG + exif_error_docref(NULL EXIFERR_CC, ImageInfo, E_NOTICE, "Read from TIFF: filesize(x%04X), IFD dir(x%04X + x%04X)", ImageInfo->FileSize, dir_offset, 2); +#endif + php_stream_seek(ImageInfo->infile, dir_offset, SEEK_SET); /* we do not know the order of sections */ + php_stream_read(ImageInfo->infile, (char*)ImageInfo->file.list[sn].data, 2); + num_entries = php_ifd_get16u(ImageInfo->file.list[sn].data, ImageInfo->motorola_intel); + dir_size = 2/*num dir entries*/ +12/*length of entry*/*num_entries +4/* offset to next ifd (points to thumbnail or NULL)*/; + if (ImageInfo->FileSize >= dir_offset+dir_size) { +#ifdef EXIF_DEBUG + exif_error_docref(NULL EXIFERR_CC, ImageInfo, E_NOTICE, "Read from TIFF: filesize(x%04X), IFD dir(x%04X + x%04X), IFD entries(%d)", ImageInfo->FileSize, dir_offset+2, dir_size-2, num_entries); +#endif + if (exif_file_sections_realloc(ImageInfo, sn, dir_size TSRMLS_CC)) { + return FALSE; + } + php_stream_read(ImageInfo->infile, (char*)(ImageInfo->file.list[sn].data+2), dir_size-2); + /*exif_error_docref(NULL EXIFERR_CC, ImageInfo, E_NOTICE, "Dump: %s", exif_char_dump(ImageInfo->file.list[sn].data, dir_size, 0));*/ + next_offset = php_ifd_get32u(ImageInfo->file.list[sn].data + dir_size - 4, ImageInfo->motorola_intel); +#ifdef EXIF_DEBUG + exif_error_docref(NULL EXIFERR_CC, ImageInfo, E_NOTICE, "Read from TIFF done, next offset x%04X", next_offset); +#endif + /* now we have the directory we can look how long it should be */ + ifd_size = dir_size; + for(i=0;i<num_entries;i++) { + dir_entry = ImageInfo->file.list[sn].data+2+i*12; + entry_tag = php_ifd_get16u(dir_entry+0, ImageInfo->motorola_intel); + entry_type = php_ifd_get16u(dir_entry+2, ImageInfo->motorola_intel); + if (entry_type > NUM_FORMATS) { + exif_error_docref(NULL EXIFERR_CC, ImageInfo, E_NOTICE, "Read from TIFF: tag(0x%04X,%12s): Illegal format code 0x%04X, switching to BYTE", entry_tag, exif_get_tagname(entry_tag, tagname, -12, tag_table TSRMLS_CC), entry_type); + /* Since this is repeated in exif_process_IFD_TAG make it a notice here */ + /* and make it a warning in the exif_process_IFD_TAG which is called */ + /* elsewhere. */ + entry_type = TAG_FMT_BYTE; + /*The next line would break the image on writeback: */ + /* php_ifd_set16u(dir_entry+2, entry_type, ImageInfo->motorola_intel);*/ + } + entry_length = php_ifd_get32u(dir_entry+4, ImageInfo->motorola_intel) * php_tiff_bytes_per_format[entry_type]; + if (entry_length <= 4) { + switch(entry_type) { + case TAG_FMT_USHORT: + entry_value = php_ifd_get16u(dir_entry+8, ImageInfo->motorola_intel); + break; + case TAG_FMT_SSHORT: + entry_value = php_ifd_get16s(dir_entry+8, ImageInfo->motorola_intel); + break; + case TAG_FMT_ULONG: + entry_value = php_ifd_get32u(dir_entry+8, ImageInfo->motorola_intel); + break; + case TAG_FMT_SLONG: + entry_value = php_ifd_get32s(dir_entry+8, ImageInfo->motorola_intel); + break; + } + switch(entry_tag) { + case TAG_IMAGEWIDTH: + case TAG_COMP_IMAGE_WIDTH: + ImageInfo->Width = entry_value; + break; + case TAG_IMAGEHEIGHT: + case TAG_COMP_IMAGE_HEIGHT: + ImageInfo->Height = entry_value; + break; + case TAG_PHOTOMETRIC_INTERPRETATION: + switch (entry_value) { + case PMI_BLACK_IS_ZERO: + case PMI_WHITE_IS_ZERO: + case PMI_TRANSPARENCY_MASK: + ImageInfo->IsColor = 0; + break; + case PMI_RGB: + case PMI_PALETTE_COLOR: + case PMI_SEPARATED: + case PMI_YCBCR: + case PMI_CIELAB: + ImageInfo->IsColor = 1; + break; + } + break; + } + } else { + entry_offset = php_ifd_get32u(dir_entry+8, ImageInfo->motorola_intel); + /* if entry needs expading ifd cache and entry is at end of current ifd cache. */ + /* otherwise there may be huge holes between two entries */ + if (entry_offset + entry_length > dir_offset + ifd_size + && entry_offset == dir_offset + ifd_size) { + ifd_size = entry_offset + entry_length - dir_offset; +#ifdef EXIF_DEBUG + exif_error_docref(NULL EXIFERR_CC, ImageInfo, E_NOTICE, "Resize struct: x%04X + x%04X - x%04X = x%04X", entry_offset, entry_length, dir_offset, ifd_size); +#endif + } + } + } + if (ImageInfo->FileSize >= dir_offset + ImageInfo->file.list[sn].size) { + if (ifd_size > dir_size) { + if (dir_offset + ifd_size > ImageInfo->FileSize) { + exif_error_docref(NULL EXIFERR_CC, ImageInfo, E_WARNING, "Error in TIFF: filesize(x%04X) less than size of IFD(x%04X + x%04X)", ImageInfo->FileSize, dir_offset, ifd_size); + return FALSE; + } + if (exif_file_sections_realloc(ImageInfo, sn, ifd_size TSRMLS_CC)) { + return FALSE; + } + /* read values not stored in directory itself */ +#ifdef EXIF_DEBUG + exif_error_docref(NULL EXIFERR_CC, ImageInfo, E_NOTICE, "Read from TIFF: filesize(x%04X), IFD(x%04X + x%04X)", ImageInfo->FileSize, dir_offset, ifd_size); +#endif + php_stream_read(ImageInfo->infile, (char*)(ImageInfo->file.list[sn].data+dir_size), ifd_size-dir_size); +#ifdef EXIF_DEBUG + exif_error_docref(NULL EXIFERR_CC, ImageInfo, E_NOTICE, "Read from TIFF, done"); +#endif + } + /* now process the tags */ + for(i=0;i<num_entries;i++) { + dir_entry = ImageInfo->file.list[sn].data+2+i*12; + entry_tag = php_ifd_get16u(dir_entry+0, ImageInfo->motorola_intel); + entry_type = php_ifd_get16u(dir_entry+2, ImageInfo->motorola_intel); + /*entry_length = php_ifd_get32u(dir_entry+4, ImageInfo->motorola_intel);*/ + if (entry_tag == TAG_EXIF_IFD_POINTER || + entry_tag == TAG_INTEROP_IFD_POINTER || + entry_tag == TAG_GPS_IFD_POINTER || + entry_tag == TAG_SUB_IFD + ) { + switch(entry_tag) { + case TAG_EXIF_IFD_POINTER: + ImageInfo->sections_found |= FOUND_EXIF; + sub_section_index = SECTION_EXIF; + break; + case TAG_GPS_IFD_POINTER: + ImageInfo->sections_found |= FOUND_GPS; + sub_section_index = SECTION_GPS; + break; + case TAG_INTEROP_IFD_POINTER: + ImageInfo->sections_found |= FOUND_INTEROP; + sub_section_index = SECTION_INTEROP; + break; + case TAG_SUB_IFD: + ImageInfo->sections_found |= FOUND_THUMBNAIL; + sub_section_index = SECTION_THUMBNAIL; + break; + } + entry_offset = php_ifd_get32u(dir_entry+8, ImageInfo->motorola_intel); +#ifdef EXIF_DEBUG + exif_error_docref(NULL EXIFERR_CC, ImageInfo, E_NOTICE, "Next IFD: %s @x%04X", exif_get_sectionname(sub_section_index), entry_offset); +#endif + ImageInfo->ifd_nesting_level++; + exif_process_IFD_in_TIFF(ImageInfo, entry_offset, sub_section_index TSRMLS_CC); + if (section_index!=SECTION_THUMBNAIL && entry_tag==TAG_SUB_IFD) { + if (ImageInfo->Thumbnail.filetype != IMAGE_FILETYPE_UNKNOWN + && ImageInfo->Thumbnail.size + && ImageInfo->Thumbnail.offset + && ImageInfo->read_thumbnail + ) { +#ifdef EXIF_DEBUG + exif_error_docref(NULL EXIFERR_CC, ImageInfo, E_NOTICE, "%s THUMBNAIL @0x%04X + 0x%04X", ImageInfo->Thumbnail.data ? "Ignore" : "Read", ImageInfo->Thumbnail.offset, ImageInfo->Thumbnail.size); +#endif + if (!ImageInfo->Thumbnail.data) { + ImageInfo->Thumbnail.data = safe_emalloc(ImageInfo->Thumbnail.size, 1, 0); + php_stream_seek(ImageInfo->infile, ImageInfo->Thumbnail.offset, SEEK_SET); + fgot = php_stream_read(ImageInfo->infile, ImageInfo->Thumbnail.data, ImageInfo->Thumbnail.size); + if (fgot < ImageInfo->Thumbnail.size) { + EXIF_ERRLOG_THUMBEOF(ImageInfo) + } + exif_thumbnail_build(ImageInfo TSRMLS_CC); + } + } + } +#ifdef EXIF_DEBUG + exif_error_docref(NULL EXIFERR_CC, ImageInfo, E_NOTICE, "Next IFD: %s done", exif_get_sectionname(sub_section_index)); +#endif + } else { + if (!exif_process_IFD_TAG(ImageInfo, (char*)dir_entry, + (char*)(ImageInfo->file.list[sn].data-dir_offset), + ifd_size, 0, section_index, 0, tag_table TSRMLS_CC)) { + return FALSE; + } + } + } + /* If we had a thumbnail in a SUB_IFD we have ANOTHER image in NEXT IFD */ + if (next_offset && section_index != SECTION_THUMBNAIL) { + /* this should be a thumbnail IFD */ + /* the thumbnail itself is stored at Tag=StripOffsets */ +#ifdef EXIF_DEBUG + exif_error_docref(NULL EXIFERR_CC, ImageInfo, E_NOTICE, "Read next IFD (THUMBNAIL) at x%04X", next_offset); +#endif + ImageInfo->ifd_nesting_level++; + exif_process_IFD_in_TIFF(ImageInfo, next_offset, SECTION_THUMBNAIL TSRMLS_CC); +#ifdef EXIF_DEBUG + exif_error_docref(NULL EXIFERR_CC, ImageInfo, E_NOTICE, "%s THUMBNAIL @0x%04X + 0x%04X", ImageInfo->Thumbnail.data ? "Ignore" : "Read", ImageInfo->Thumbnail.offset, ImageInfo->Thumbnail.size); +#endif + if (!ImageInfo->Thumbnail.data && ImageInfo->Thumbnail.offset && ImageInfo->Thumbnail.size && ImageInfo->read_thumbnail) { + ImageInfo->Thumbnail.data = safe_emalloc(ImageInfo->Thumbnail.size, 1, 0); + php_stream_seek(ImageInfo->infile, ImageInfo->Thumbnail.offset, SEEK_SET); + fgot = php_stream_read(ImageInfo->infile, ImageInfo->Thumbnail.data, ImageInfo->Thumbnail.size); + if (fgot < ImageInfo->Thumbnail.size) { + EXIF_ERRLOG_THUMBEOF(ImageInfo) + } + exif_thumbnail_build(ImageInfo TSRMLS_CC); + } +#ifdef EXIF_DEBUG + exif_error_docref(NULL EXIFERR_CC, ImageInfo, E_NOTICE, "Read next IFD (THUMBNAIL) done"); +#endif + } + return TRUE; + } else { + exif_error_docref(NULL EXIFERR_CC, ImageInfo, E_WARNING, "Error in TIFF: filesize(x%04X) less than size of IFD(x%04X)", ImageInfo->FileSize, dir_offset+ImageInfo->file.list[sn].size); + return FALSE; + } + } else { + exif_error_docref(NULL EXIFERR_CC, ImageInfo, E_WARNING, "Error in TIFF: filesize(x%04X) less than size of IFD dir(x%04X)", ImageInfo->FileSize, dir_offset+dir_size); + return FALSE; + } + } else { + exif_error_docref(NULL EXIFERR_CC, ImageInfo, E_WARNING, "Error in TIFF: filesize(x%04X) less than start of IFD dir(x%04X)", ImageInfo->FileSize, dir_offset+2); + return FALSE; + } +} +/* }}} */ + +/* {{{ exif_scan_FILE_header + * Parse the marker stream until SOS or EOI is seen; */ +static int exif_scan_FILE_header(image_info_type *ImageInfo TSRMLS_DC) +{ + unsigned char file_header[8]; + int ret = FALSE; + + ImageInfo->FileType = IMAGE_FILETYPE_UNKNOWN; + + if (ImageInfo->FileSize >= 2) { + php_stream_seek(ImageInfo->infile, 0, SEEK_SET); + if (php_stream_read(ImageInfo->infile, (char*)file_header, 2) != 2) { + return FALSE; + } + if ((file_header[0]==0xff) && (file_header[1]==M_SOI)) { + ImageInfo->FileType = IMAGE_FILETYPE_JPEG; + if (exif_scan_JPEG_header(ImageInfo TSRMLS_CC)) { + ret = TRUE; + } else { + exif_error_docref(NULL EXIFERR_CC, ImageInfo, E_WARNING, "Invalid JPEG file"); + } + } else if (ImageInfo->FileSize >= 8) { + if (php_stream_read(ImageInfo->infile, (char*)(file_header+2), 6) != 6) { + return FALSE; + } + if (!memcmp(file_header, "II\x2A\x00", 4)) { + ImageInfo->FileType = IMAGE_FILETYPE_TIFF_II; + ImageInfo->motorola_intel = 0; +#ifdef EXIF_DEBUG + exif_error_docref(NULL EXIFERR_CC, ImageInfo, E_NOTICE, "File has TIFF/II format"); +#endif + ImageInfo->sections_found |= FOUND_IFD0; + if (exif_process_IFD_in_TIFF(ImageInfo, + php_ifd_get32u(file_header + 4, ImageInfo->motorola_intel), + SECTION_IFD0 TSRMLS_CC)) { + ret = TRUE; + } else { + exif_error_docref(NULL EXIFERR_CC, ImageInfo, E_WARNING, "Invalid TIFF file"); + } + } else if (!memcmp(file_header, "MM\x00\x2a", 4)) { + ImageInfo->FileType = IMAGE_FILETYPE_TIFF_MM; + ImageInfo->motorola_intel = 1; +#ifdef EXIF_DEBUG + exif_error_docref(NULL EXIFERR_CC, ImageInfo, E_NOTICE, "File has TIFF/MM format"); +#endif + ImageInfo->sections_found |= FOUND_IFD0; + if (exif_process_IFD_in_TIFF(ImageInfo, + php_ifd_get32u(file_header + 4, ImageInfo->motorola_intel), + SECTION_IFD0 TSRMLS_CC)) { + ret = TRUE; + } else { + exif_error_docref(NULL EXIFERR_CC, ImageInfo, E_WARNING, "Invalid TIFF file"); + } + } else { + exif_error_docref(NULL EXIFERR_CC, ImageInfo, E_WARNING, "File not supported"); + return FALSE; + } + } + } else { + exif_error_docref(NULL EXIFERR_CC, ImageInfo, E_WARNING, "File too small (%d)", ImageInfo->FileSize); + } + return ret; +} +/* }}} */ + +/* {{{ exif_discard_imageinfo + Discard data scanned by exif_read_file. +*/ +static int exif_discard_imageinfo(image_info_type *ImageInfo) +{ + int i; + + EFREE_IF(ImageInfo->FileName); + EFREE_IF(ImageInfo->UserComment); + EFREE_IF(ImageInfo->UserCommentEncoding); + EFREE_IF(ImageInfo->Copyright); + EFREE_IF(ImageInfo->CopyrightPhotographer); + EFREE_IF(ImageInfo->CopyrightEditor); + EFREE_IF(ImageInfo->Thumbnail.data); + EFREE_IF(ImageInfo->encode_unicode); + EFREE_IF(ImageInfo->decode_unicode_be); + EFREE_IF(ImageInfo->decode_unicode_le); + EFREE_IF(ImageInfo->encode_jis); + EFREE_IF(ImageInfo->decode_jis_be); + EFREE_IF(ImageInfo->decode_jis_le); + EFREE_IF(ImageInfo->make); + EFREE_IF(ImageInfo->model); + for (i=0; i<ImageInfo->xp_fields.count; i++) { + EFREE_IF(ImageInfo->xp_fields.list[i].value); + } + EFREE_IF(ImageInfo->xp_fields.list); + for (i=0; i<SECTION_COUNT; i++) { + exif_iif_free(ImageInfo, i); + } + exif_file_sections_free(ImageInfo); + memset(ImageInfo, 0, sizeof(*ImageInfo)); + return TRUE; +} +/* }}} */ + +/* {{{ exif_read_file + */ +static int exif_read_file(image_info_type *ImageInfo, char *FileName, int read_thumbnail, int read_all TSRMLS_DC) +{ + int ret; + struct stat st; + + /* Start with an empty image information structure. */ + memset(ImageInfo, 0, sizeof(*ImageInfo)); + + ImageInfo->motorola_intel = -1; /* flag as unknown */ + + ImageInfo->infile = php_stream_open_wrapper(FileName, "rb", STREAM_MUST_SEEK|IGNORE_PATH, NULL); + if (!ImageInfo->infile) { + exif_error_docref(NULL EXIFERR_CC, ImageInfo, E_WARNING, "Unable to open file"); + return FALSE; + } + + if (php_stream_is(ImageInfo->infile, PHP_STREAM_IS_STDIO)) { + if (VCWD_STAT(FileName, &st) >= 0) { + if ((st.st_mode & S_IFMT) != S_IFREG) { + exif_error_docref(NULL EXIFERR_CC, ImageInfo, E_WARNING, "Not a file"); + php_stream_close(ImageInfo->infile); + return FALSE; + } + + /* Store file date/time. */ + ImageInfo->FileDateTime = st.st_mtime; + ImageInfo->FileSize = st.st_size; + /*exif_error_docref(NULL EXIFERR_CC, ImageInfo, E_NOTICE, "Opened stream is file: %d", ImageInfo->FileSize);*/ + } + } else { + if (!ImageInfo->FileSize) { + php_stream_seek(ImageInfo->infile, 0, SEEK_END); + ImageInfo->FileSize = php_stream_tell(ImageInfo->infile); + php_stream_seek(ImageInfo->infile, 0, SEEK_SET); + } + } + + php_basename(FileName, strlen(FileName), NULL, 0, &(ImageInfo->FileName), NULL TSRMLS_CC); + ImageInfo->read_thumbnail = read_thumbnail; + ImageInfo->read_all = read_all; + ImageInfo->Thumbnail.filetype = IMAGE_FILETYPE_UNKNOWN; + + ImageInfo->encode_unicode = safe_estrdup(EXIF_G(encode_unicode)); + ImageInfo->decode_unicode_be = safe_estrdup(EXIF_G(decode_unicode_be)); + ImageInfo->decode_unicode_le = safe_estrdup(EXIF_G(decode_unicode_le)); + ImageInfo->encode_jis = safe_estrdup(EXIF_G(encode_jis)); + ImageInfo->decode_jis_be = safe_estrdup(EXIF_G(decode_jis_be)); + ImageInfo->decode_jis_le = safe_estrdup(EXIF_G(decode_jis_le)); + + + ImageInfo->ifd_nesting_level = 0; + + /* Scan the JPEG headers. */ + ret = exif_scan_FILE_header(ImageInfo TSRMLS_CC); + + php_stream_close(ImageInfo->infile); + return ret; +} +/* }}} */ + +/* {{{ proto array exif_read_data(string filename [, sections_needed [, sub_arrays[, read_thumbnail]]]) + Reads header data from the JPEG/TIFF image filename and optionally reads the internal thumbnails */ +PHP_FUNCTION(exif_read_data) +{ + char *p_name, *p_sections_needed = NULL; + int p_name_len, p_sections_needed_len = 0; + zend_bool sub_arrays=0, read_thumbnail=0, read_all=0; + + int i, ret, sections_needed=0; + image_info_type ImageInfo; + char tmp[64], *sections_str, *s; + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "p|sbb", &p_name, &p_name_len, &p_sections_needed, &p_sections_needed_len, &sub_arrays, &read_thumbnail) == FAILURE) { + return; + } + + memset(&ImageInfo, 0, sizeof(ImageInfo)); + + if (p_sections_needed) { + spprintf(§ions_str, 0, ",%s,", p_sections_needed); + /* sections_str DOES start with , and SPACES are NOT allowed in names */ + s = sections_str; + while (*++s) { + if (*s == ' ') { + *s = ','; + } + } + + for (i = 0; i < SECTION_COUNT; i++) { + snprintf(tmp, sizeof(tmp), ",%s,", exif_get_sectionname(i)); + if (strstr(sections_str, tmp)) { + sections_needed |= 1<<i; + } + } + EFREE_IF(sections_str); + /* now see what we need */ +#ifdef EXIF_DEBUG + sections_str = exif_get_sectionlist(sections_needed TSRMLS_CC); + if (!sections_str) { + RETURN_FALSE; + } + exif_error_docref(NULL EXIFERR_CC, &ImageInfo, E_NOTICE, "Sections needed: %s", sections_str[0] ? sections_str : "None"); + EFREE_IF(sections_str); +#endif + } + + ret = exif_read_file(&ImageInfo, p_name, read_thumbnail, read_all TSRMLS_CC); + sections_str = exif_get_sectionlist(ImageInfo.sections_found TSRMLS_CC); + +#ifdef EXIF_DEBUG + if (sections_str) + exif_error_docref(NULL EXIFERR_CC, &ImageInfo, E_NOTICE, "Sections found: %s", sections_str[0] ? sections_str : "None"); +#endif + + ImageInfo.sections_found |= FOUND_COMPUTED|FOUND_FILE;/* do not inform about in debug*/ + + if (ret == FALSE || (sections_needed && !(sections_needed&ImageInfo.sections_found))) { + /* array_init must be checked at last! otherwise the array must be freed if a later test fails. */ + exif_discard_imageinfo(&ImageInfo); + EFREE_IF(sections_str); + RETURN_FALSE; + } + + array_init(return_value); + +#ifdef EXIF_DEBUG + exif_error_docref(NULL EXIFERR_CC, &ImageInfo, E_NOTICE, "Generate section FILE"); +#endif + + /* now we can add our information */ + exif_iif_add_str(&ImageInfo, SECTION_FILE, "FileName", ImageInfo.FileName TSRMLS_CC); + exif_iif_add_int(&ImageInfo, SECTION_FILE, "FileDateTime", ImageInfo.FileDateTime TSRMLS_CC); + exif_iif_add_int(&ImageInfo, SECTION_FILE, "FileSize", ImageInfo.FileSize TSRMLS_CC); + exif_iif_add_int(&ImageInfo, SECTION_FILE, "FileType", ImageInfo.FileType TSRMLS_CC); + exif_iif_add_str(&ImageInfo, SECTION_FILE, "MimeType", (char*)php_image_type_to_mime_type(ImageInfo.FileType) TSRMLS_CC); + exif_iif_add_str(&ImageInfo, SECTION_FILE, "SectionsFound", sections_str ? sections_str : "NONE" TSRMLS_CC); + +#ifdef EXIF_DEBUG + exif_error_docref(NULL EXIFERR_CC, &ImageInfo, E_NOTICE, "Generate section COMPUTED"); +#endif + + if (ImageInfo.Width>0 && ImageInfo.Height>0) { + exif_iif_add_fmt(&ImageInfo, SECTION_COMPUTED, "html" TSRMLS_CC, "width=\"%d\" height=\"%d\"", ImageInfo.Width, ImageInfo.Height); + exif_iif_add_int(&ImageInfo, SECTION_COMPUTED, "Height", ImageInfo.Height TSRMLS_CC); + exif_iif_add_int(&ImageInfo, SECTION_COMPUTED, "Width", ImageInfo.Width TSRMLS_CC); + } + exif_iif_add_int(&ImageInfo, SECTION_COMPUTED, "IsColor", ImageInfo.IsColor TSRMLS_CC); + if (ImageInfo.motorola_intel != -1) { + exif_iif_add_int(&ImageInfo, SECTION_COMPUTED, "ByteOrderMotorola", ImageInfo.motorola_intel TSRMLS_CC); + } + if (ImageInfo.FocalLength) { + exif_iif_add_fmt(&ImageInfo, SECTION_COMPUTED, "FocalLength" TSRMLS_CC, "%4.1Fmm", ImageInfo.FocalLength); + if(ImageInfo.CCDWidth) { + exif_iif_add_fmt(&ImageInfo, SECTION_COMPUTED, "35mmFocalLength" TSRMLS_CC, "%dmm", (int)(ImageInfo.FocalLength/ImageInfo.CCDWidth*35+0.5)); + } + } + if(ImageInfo.CCDWidth) { + exif_iif_add_fmt(&ImageInfo, SECTION_COMPUTED, "CCDWidth" TSRMLS_CC, "%dmm", (int)ImageInfo.CCDWidth); + } + if(ImageInfo.ExposureTime>0) { + if(ImageInfo.ExposureTime <= 0.5) { + exif_iif_add_fmt(&ImageInfo, SECTION_COMPUTED, "ExposureTime" TSRMLS_CC, "%0.3F s (1/%d)", ImageInfo.ExposureTime, (int)(0.5 + 1/ImageInfo.ExposureTime)); + } else { + exif_iif_add_fmt(&ImageInfo, SECTION_COMPUTED, "ExposureTime" TSRMLS_CC, "%0.3F s", ImageInfo.ExposureTime); + } + } + if(ImageInfo.ApertureFNumber) { + exif_iif_add_fmt(&ImageInfo, SECTION_COMPUTED, "ApertureFNumber" TSRMLS_CC, "f/%.1F", ImageInfo.ApertureFNumber); + } + if(ImageInfo.Distance) { + if(ImageInfo.Distance<0) { + exif_iif_add_str(&ImageInfo, SECTION_COMPUTED, "FocusDistance", "Infinite" TSRMLS_CC); + } else { + exif_iif_add_fmt(&ImageInfo, SECTION_COMPUTED, "FocusDistance" TSRMLS_CC, "%0.2Fm", ImageInfo.Distance); + } + } + if (ImageInfo.UserComment) { + exif_iif_add_buffer(&ImageInfo, SECTION_COMPUTED, "UserComment", ImageInfo.UserCommentLength, ImageInfo.UserComment TSRMLS_CC); + if (ImageInfo.UserCommentEncoding && strlen(ImageInfo.UserCommentEncoding)) { + exif_iif_add_str(&ImageInfo, SECTION_COMPUTED, "UserCommentEncoding", ImageInfo.UserCommentEncoding TSRMLS_CC); + } + } + + exif_iif_add_str(&ImageInfo, SECTION_COMPUTED, "Copyright", ImageInfo.Copyright TSRMLS_CC); + exif_iif_add_str(&ImageInfo, SECTION_COMPUTED, "Copyright.Photographer", ImageInfo.CopyrightPhotographer TSRMLS_CC); + exif_iif_add_str(&ImageInfo, SECTION_COMPUTED, "Copyright.Editor", ImageInfo.CopyrightEditor TSRMLS_CC); + + for (i=0; i<ImageInfo.xp_fields.count; i++) { + exif_iif_add_str(&ImageInfo, SECTION_WINXP, exif_get_tagname(ImageInfo.xp_fields.list[i].tag, NULL, 0, exif_get_tag_table(SECTION_WINXP) TSRMLS_CC), ImageInfo.xp_fields.list[i].value TSRMLS_CC); + } + if (ImageInfo.Thumbnail.size) { + if (read_thumbnail) { + /* not exif_iif_add_str : this is a buffer */ + exif_iif_add_tag(&ImageInfo, SECTION_THUMBNAIL, "THUMBNAIL", TAG_NONE, TAG_FMT_UNDEFINED, ImageInfo.Thumbnail.size, ImageInfo.Thumbnail.data TSRMLS_CC); + } + if (!ImageInfo.Thumbnail.width || !ImageInfo.Thumbnail.height) { + /* try to evaluate if thumbnail data is present */ + exif_scan_thumbnail(&ImageInfo TSRMLS_CC); + } + exif_iif_add_int(&ImageInfo, SECTION_COMPUTED, "Thumbnail.FileType", ImageInfo.Thumbnail.filetype TSRMLS_CC); + exif_iif_add_str(&ImageInfo, SECTION_COMPUTED, "Thumbnail.MimeType", (char*)php_image_type_to_mime_type(ImageInfo.Thumbnail.filetype) TSRMLS_CC); + } + if (ImageInfo.Thumbnail.width && ImageInfo.Thumbnail.height) { + exif_iif_add_int(&ImageInfo, SECTION_COMPUTED, "Thumbnail.Height", ImageInfo.Thumbnail.height TSRMLS_CC); + exif_iif_add_int(&ImageInfo, SECTION_COMPUTED, "Thumbnail.Width", ImageInfo.Thumbnail.width TSRMLS_CC); + } + EFREE_IF(sections_str); + +#ifdef EXIF_DEBUG + exif_error_docref(NULL EXIFERR_CC, &ImageInfo, E_NOTICE, "Adding image infos"); +#endif + + add_assoc_image_info(return_value, sub_arrays, &ImageInfo, SECTION_FILE TSRMLS_CC); + add_assoc_image_info(return_value, 1, &ImageInfo, SECTION_COMPUTED TSRMLS_CC); + add_assoc_image_info(return_value, sub_arrays, &ImageInfo, SECTION_ANY_TAG TSRMLS_CC); + add_assoc_image_info(return_value, sub_arrays, &ImageInfo, SECTION_IFD0 TSRMLS_CC); + add_assoc_image_info(return_value, 1, &ImageInfo, SECTION_THUMBNAIL TSRMLS_CC); + add_assoc_image_info(return_value, 1, &ImageInfo, SECTION_COMMENT TSRMLS_CC); + add_assoc_image_info(return_value, sub_arrays, &ImageInfo, SECTION_EXIF TSRMLS_CC); + add_assoc_image_info(return_value, sub_arrays, &ImageInfo, SECTION_GPS TSRMLS_CC); + add_assoc_image_info(return_value, sub_arrays, &ImageInfo, SECTION_INTEROP TSRMLS_CC); + add_assoc_image_info(return_value, sub_arrays, &ImageInfo, SECTION_FPIX TSRMLS_CC); + add_assoc_image_info(return_value, sub_arrays, &ImageInfo, SECTION_APP12 TSRMLS_CC); + add_assoc_image_info(return_value, sub_arrays, &ImageInfo, SECTION_WINXP TSRMLS_CC); + add_assoc_image_info(return_value, sub_arrays, &ImageInfo, SECTION_MAKERNOTE TSRMLS_CC); + +#ifdef EXIF_DEBUG + exif_error_docref(NULL EXIFERR_CC, &ImageInfo, E_NOTICE, "Discarding info"); +#endif + + exif_discard_imageinfo(&ImageInfo); + +#ifdef EXIF_DEBUG + php_error_docref1(NULL TSRMLS_CC, Z_STRVAL_PP(p_name), E_NOTICE, "done"); +#endif +} +/* }}} */ + +/* {{{ proto string exif_thumbnail(string filename [, &width, &height [, &imagetype]]) + Reads the embedded thumbnail */ +PHP_FUNCTION(exif_thumbnail) +{ + zval *p_width = 0, *p_height = 0, *p_imagetype = 0; + char *p_name; + int p_name_len, ret, arg_c = ZEND_NUM_ARGS(); + image_info_type ImageInfo; + + memset(&ImageInfo, 0, sizeof(ImageInfo)); + + if (arg_c!=1 && arg_c!=3 && arg_c!=4) { + WRONG_PARAM_COUNT; + } + + if (zend_parse_parameters(arg_c TSRMLS_CC, "p|z/z/z/", &p_name, &p_name_len, &p_width, &p_height, &p_imagetype) == FAILURE) { + return; + } + + ret = exif_read_file(&ImageInfo, p_name, 1, 0 TSRMLS_CC); + if (ret==FALSE) { + exif_discard_imageinfo(&ImageInfo); + RETURN_FALSE; + } + +#ifdef EXIF_DEBUG + exif_error_docref(NULL EXIFERR_CC, &ImageInfo, E_NOTICE, "Thumbnail data %d %d %d, %d x %d", ImageInfo.Thumbnail.data, ImageInfo.Thumbnail.size, ImageInfo.Thumbnail.filetype, ImageInfo.Thumbnail.width, ImageInfo.Thumbnail.height); +#endif + if (!ImageInfo.Thumbnail.data || !ImageInfo.Thumbnail.size) { + exif_discard_imageinfo(&ImageInfo); + RETURN_FALSE; + } + +#ifdef EXIF_DEBUG + exif_error_docref(NULL EXIFERR_CC, &ImageInfo, E_NOTICE, "Returning thumbnail(%d)", ImageInfo.Thumbnail.size); +#endif + + ZVAL_STRINGL(return_value, ImageInfo.Thumbnail.data, ImageInfo.Thumbnail.size, 1); + if (arg_c >= 3) { + if (!ImageInfo.Thumbnail.width || !ImageInfo.Thumbnail.height) { + exif_scan_thumbnail(&ImageInfo TSRMLS_CC); + } + zval_dtor(p_width); + zval_dtor(p_height); + ZVAL_LONG(p_width, ImageInfo.Thumbnail.width); + ZVAL_LONG(p_height, ImageInfo.Thumbnail.height); + } + if (arg_c >= 4) { + zval_dtor(p_imagetype); + ZVAL_LONG(p_imagetype, ImageInfo.Thumbnail.filetype); + } + +#ifdef EXIF_DEBUG + exif_error_docref(NULL EXIFERR_CC, &ImageInfo, E_NOTICE, "Discarding info"); +#endif + + exif_discard_imageinfo(&ImageInfo); + +#ifdef EXIF_DEBUG + php_error_docref1(NULL TSRMLS_CC, p_name, E_NOTICE, "Done"); +#endif +} +/* }}} */ + +/* {{{ proto int exif_imagetype(string imagefile) + Get the type of an image */ +PHP_FUNCTION(exif_imagetype) +{ + char *imagefile; + int imagefile_len; + php_stream * stream; + int itype = 0; + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &imagefile, &imagefile_len) == FAILURE) { + return; + } + + stream = php_stream_open_wrapper(imagefile, "rb", IGNORE_PATH|REPORT_ERRORS, NULL); + + if (stream == NULL) { + RETURN_FALSE; + } + + itype = php_getimagetype(stream, NULL TSRMLS_CC); + + php_stream_close(stream); + + if (itype == IMAGE_FILETYPE_UNKNOWN) { + RETURN_FALSE; + } else { + ZVAL_LONG(return_value, itype); + } +} +/* }}} */ + +#endif + +/* + * Local variables: + * tab-width: 4 + * c-basic-offset: 4 + * End: + * vim600: sw=4 ts=4 tw=78 fdm=marker + * vim<600: sw=4 ts=4 tw=78 + */ diff --git a/ext/exif/exif.dsp b/ext/exif/exif.dsp new file mode 100644 index 0000000..4a82733 --- /dev/null +++ b/ext/exif/exif.dsp @@ -0,0 +1,113 @@ +# Microsoft Developer Studio Project File - Name="exif" - Package Owner=<4>
+# Microsoft Developer Studio Generated Build File, Format Version 6.00
+# ** DO NOT EDIT **
+
+# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102
+
+CFG=exif - Win32 Release_TS
+!MESSAGE This is not a valid makefile. To build this project using NMAKE,
+!MESSAGE use the Export Makefile command and run
+!MESSAGE
+!MESSAGE NMAKE /f "exif.mak".
+!MESSAGE
+!MESSAGE You can specify a configuration when running NMAKE
+!MESSAGE by defining the macro CFG on the command line. For example:
+!MESSAGE
+!MESSAGE NMAKE /f "exif.mak" CFG="exif - Win32 Release_TS"
+!MESSAGE
+!MESSAGE Possible choices for configuration are:
+!MESSAGE
+!MESSAGE "exif - Win32 Release_TS" (based on "Win32 (x86) Dynamic-Link Library")
+!MESSAGE "exif - Win32 Debug_TS" (based on "Win32 (x86) Dynamic-Link Library")
+!MESSAGE
+
+# Begin Project
+# PROP AllowPerConfigDependencies 0
+# PROP Scc_ProjName ""
+# PROP Scc_LocalPath ""
+CPP=cl.exe
+MTL=midl.exe
+RSC=rc.exe
+
+!IF "$(CFG)" == "exif - Win32 Release_TS"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 0
+# PROP BASE Output_Dir "Release_TS"
+# PROP BASE Intermediate_Dir "Release_TS"
+# PROP BASE Ignore_Export_Lib 0
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 0
+# PROP Output_Dir "Release_TS"
+# PROP Intermediate_Dir "Release_TS"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /MT /W3 /GX /O2 /I "..\.." /I "..\..\..\Zend" /I "..\..\..\bindlib_w32" /I "..\..\..\TSRM" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "COMPILE_DL_EXIF" /D ZTS=1 /YX /FD /c
+# ADD CPP /nologo /MD /W3 /GX /O2 /I "..\.." /I "..\..\main" /I "..\..\Zend" /I "..\..\..\bindlib_w32" /I "..\..\TSRM" /D ZEND_DEBUG=0 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "EXIF_EXPORTS" /D "COMPILE_DL_EXIF" /D ZTS=1 /D "ZEND_WIN32" /D "PHP_WIN32" /D HAVE_EXIF=1 /FR /YX /FD /c
+# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
+# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
+# ADD BASE RSC /l 0x406 /d "NDEBUG"
+# ADD RSC /l 0x406 /d "NDEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib php5ts.lib /nologo /dll /machine:I386
+# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib php5ts.lib /nologo /dll /machine:I386 /out:"..\..\Release_TS/php_exif.dll" /libpath:"..\..\Release_TS" /libpath:"..\..\Release_TS_Inline"
+
+!ELSEIF "$(CFG)" == "exif - Win32 Debug_TS"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 0
+# PROP BASE Output_Dir "Debug_TS"
+# PROP BASE Intermediate_Dir "Debug_TS"
+# PROP BASE Ignore_Export_Lib 0
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 0
+# PROP Output_Dir "Debug_TS"
+# PROP Intermediate_Dir "Debug_TS"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /MT /W3 /GX /O2 /I "..\.." /I "..\..\Zend" /I "..\..\..\bindlib_w32" /I "..\..\TSRM" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "COMPILE_DL_EXIF" /D ZTS=1 /YX /FD /c
+# ADD CPP /nologo /MDd /W3 /GX /O2 /I "..\.." /I "..\..\main" /I "..\..\Zend" /I "..\..\..\bindlib_w32" /I "..\..\TSRM" /D ZEND_DEBUG=1 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "EXIF_EXPORTS" /D "COMPILE_DL_EXIF" /D ZTS=1 /D "ZEND_WIN32" /D "PHP_WIN32" /D HAVE_EXIF=1 /D "LIBZEND_EXPORTS" /YX /FD /c
+# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
+# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
+# ADD BASE RSC /l 0x406 /d "NDEBUG"
+# ADD RSC /l 0x406 /d "NDEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib php5ts.lib /nologo /dll /machine:I386
+# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib php5ts_debug.lib /nologo /dll /machine:I386 /out:"..\..\Debug_TS/php_exif.dll" /libpath:"..\..\Debug_TS"
+
+!ENDIF
+
+# Begin Target
+
+# Name "exif - Win32 Release_TS"
+# Name "exif - Win32 Debug_TS"
+# Begin Group "Source Files"
+
+# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
+# Begin Source File
+
+SOURCE=.\exif.c
+# End Source File
+# End Group
+# Begin Group "Header Files"
+
+# PROP Default_Filter "h;hpp;hxx;hm;inl"
+# Begin Source File
+
+SOURCE=.\php_exif.h
+# End Source File
+# End Group
+# Begin Group "Resource Files"
+
+# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
+# End Group
+# End Target
+# End Project
diff --git a/ext/exif/package.xml b/ext/exif/package.xml new file mode 100644 index 0000000..6bdb089 --- /dev/null +++ b/ext/exif/package.xml @@ -0,0 +1,62 @@ +<?xml version="1.0" encoding="ISO-8859-1" ?> +<!DOCTYPE package SYSTEM "../pear/package.dtd"> +<package> + <name>exif</name> + <summary>Read header information from JPEG and DIFF headers</summary> + <maintainers> + <maintainer> + <user>rasmus</user> + <name>Rasmus Lerdorf</name> + <email>helly@php.net</email> + <role>lead</role> + </maintainer> + <maintainer> + <user>helly</user> + <name>Markus Boerger</name> + <email>helly@php.net</email> + <role>lead</role> + </maintainer> + </maintainers> + <description> +The EXIF functions provide access to information stored in headers +of JPEG and TIFF images. This way you can read meta data generated +by digital cameras and certain image processing applications. + </description> + <license>PHP</license> + <release> + <state>beta</state> + <version>5.0.0rc1</version> + <date>2004-03-19</date> + <notes> +package.xml added to support installation using pear installer + </notes> + <filelist> + <file role="doc" name="CREDITS"/> + <file role="doc" name="example.php"/> + <file role="src" name="config.m4"/> + <file role="src" name="config.w32"/> + <file role="src" name="exif.dsp"/> + <file role="src" name="exif.c"/> + <file role="src" name="php_exif.h"/> + <file role="test" name="tests/exif000.phpt"/> + <file role="test" name="tests/exif001.phpt"/> + <file role="test" name="tests/test1.jpg"/> + <file role="test" name="tests/exif002.phpt"/> + <file role="test" name="tests/test2.jpg"/> + <file role="test" name="tests/exif003.phpt"/> + <file role="test" name="tests/test3.jpg"/> + <file role="test" name="tests/exif004.phpt"/> + <file role="test" name="tests/test4.jpg"/> + <file role="test" name="tests/exif005.phpt"/> + <file role="test" name="tests/test5.jpg"/> + <file role="test" name="tests/exif006.phpt"/> + <file role="test" name="tests/test6.jpg"/> + </filelist> + <deps> + <dep type="php" rel="ge" version="5" /> + </deps> + </release> +</package> +<!-- +vim:et:ts=1:sw=1 +--> diff --git a/ext/exif/php_exif.h b/ext/exif/php_exif.h new file mode 100644 index 0000000..5b624e0 --- /dev/null +++ b/ext/exif/php_exif.h @@ -0,0 +1,30 @@ +/* + +----------------------------------------------------------------------+ + | PHP Version 5 | + +----------------------------------------------------------------------+ + | Copyright (c) 1997-2013 The PHP Group | + +----------------------------------------------------------------------+ + | This source file is subject to version 3.01 of the PHP license, | + | that is bundled with this package in the file LICENSE, and is | + | available through the world-wide-web at the following url: | + | http://www.php.net/license/3_01.txt | + | If you did not receive a copy of the PHP license and are unable to | + | obtain it through the world-wide-web, please send a note to | + | license@php.net so we can mail you a copy immediately. | + +----------------------------------------------------------------------+ + | Authors: Rasmus Lerdorf <rasmus@php.net> | + | Marcus Boerger <helly@php.net> | + +----------------------------------------------------------------------+ + */ + +/* $Id$ */ + +#if HAVE_EXIF +extern zend_module_entry exif_module_entry; +#define phpext_exif_ptr &exif_module_entry + +PHP_FUNCTION(exif_read_data); +PHP_FUNCTION(exif_tagname); +PHP_FUNCTION(exif_thumbnail); +PHP_FUNCTION(exif_imagetype); +#endif diff --git a/ext/exif/test.php b/ext/exif/test.php new file mode 100644 index 0000000..907b9ea --- /dev/null +++ b/ext/exif/test.php @@ -0,0 +1,3 @@ +<?php + include 'test.txt'; +?>
\ No newline at end of file diff --git a/ext/exif/test.txt b/ext/exif/test.txt new file mode 100644 index 0000000..1c12b50 --- /dev/null +++ b/ext/exif/test.txt @@ -0,0 +1,365 @@ +<?php + +/* Test script for PHP module ext/exif + * + * (c) Marcus Boerger, 2002 + * + * $Id$ + * + * Rename the file to test.php and read the instructions. If the + * script cannot be executed or does not generate any output check + * you error log. In most cases this would mean you found an error + * if the rest of your php environment works fine. + * + * The original version of module exif has many errors and mostly + * fails on executing this script. + */ + +$file = array_key_exists('thumbnail',$_REQUEST) ? $_REQUEST['thumbnail'] : ''; +//$file = '/t/temp/kodak-dc4800.tif'; +//$file = '/t/temp/canon-ixus.jpg'; +//$file = '/t/temp/test2.jpg'; +if ( $file) { + $image = exif_thumbnail($file); + if ( $image!==false) { + @Header("content-type: image/jpeg"); + echo $image; + } else { + echo "<html><body><table>\n"; + echo "Thumbnail could not be extracted.\n"; + echo "</table></body></html>"; + } + die(); +} + +if ( !defined('IMAGETYPE_GIF')) define('IMAGETYPE_GIF',1); +if ( !defined('IMAGETYPE_JPEG')) define('IMAGETYPE_JPEG',2); +if ( !defined('IMAGETYPE_TIFF_II')) define('IMAGETYPE_TIFF_II',7); +if ( !defined('IMAGETYPE_TIFF_MM')) define('IMAGETYPE_TIFF_MM',8); + +$possible = array(); + +/****************************************************************************/ +// message function is used for debugging purpose: just to se what happens +function message($msg) { + error_log($msg,0); + echo "$msg\n"; +} + +function error_msg() { + $ret = '<b style="color:green">O.K.</b>'; + if (array_key_exists('php_errormsg',$GLOBALS) && strlen($GLOBALS['php_errormsg'])) { + $ret = '<b style="color:red">'.$GLOBALS['php_errormsg'].'</b>'; + $GLOBALS['php_errormsg'] = ''; + } + return $ret; +} + +/****************************************************************************/ +// private to function search_file() +function _search_file($root,&$possible,$path='') { + $sub = array(); + $cnt = 0; + $type= false; + + //error_log("search_file($root,$path)",0); + if ($dir = @opendir($root.$path.'/')) { + while (($found = @readdir($dir)) !== false) { + $type = @filetype($root.$path.'/'.$found); + //error_log("search_file($root$path):$type=$found",0); + switch( $type) { + case 'file': + $pos = strrpos($found,'.'); + if ( function_exists('exif_imagetype')) { + $type = exif_imagetype($root.$path.'/'.$found); + } else { + if ( $pos!==false) { + $type = GetImageSize($root.$path.'/'.$found); + if ( is_array($type)) { + $type = $type[2]; + } else { + $type = false; + } + } else $type = false; + } + if ( $type!==false) + { + $possible[] = array('file'=>$root.$path.'/'.$found, 'type'=>$type); + //error_log("search_file($root$path) add:$path/$found",0); + if ( ($cnt=count($possible)) % 100 == 0) { + error_log("exif test page - counting files: $cnt",0); + } + } + break; + case 'dir': + if ( $found!='.' && $found!='..') { + $sub[count($sub)] = $found; + } + break; + } + } + @closedir($dir); + foreach( $sub as $idx => $found) { + _search_file($root,$possible,$path.'/'.$found); + } + } +} + +/****************************************************************************/ +// function: search_file($file,$ext) +// +// Searches for $file in document tree. The path is ignored. +// +function search_file() { + global $argc, $argv; + $possible = array(); + + if ( $argc > 1) { + $path = $argv[1]; + } else if ( array_key_exists('SCRIPT_FILENAME',$_SERVER)) { + $path = $_SERVER['SCRIPT_FILENAME']; + //error_log("SCRIPT_FILENAME($path)",0); + } else { + $path = $argv[0]; + //error_log("argv($path)",0); + } + if ( ($p=strpos($path,'?')) !== false) $path = substr($path,0,$p); + if ( ($p=strrpos($path,'/')) /*< strlen($path)-1*/) $path = substr($path,0,$p); + error_log("exif test page - counting files in $path"); + _search_file($path,$possible); + error_log("exif test page - counting files: ".count($possible)." done.",0); + return $possible; +} + +/****************************************************************************/ +// function: search_file($file,$ext) +// +// Searches for $file in document tree. The path is ignored. +// +function AddInfo($Name,$Value,$highlight=0) { + if (is_array($Value)) $Value = 'Array: ('.join(',',$Value).')'; + $Value = nl2br($Value); + if ( $highlight) { + $Name = "<th>$Name</th>"; + } else { + $Name = "<td>$Name</td>"; + } + return "<tr>$Name<td>$Value </td></tr>\n"; +} + +$possible = search_file(); + +$title = "PHP module exif test page"; + +?><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional"> +<html> +<head> +<title><?=$title ?></title> +<style type="text/css"> +body { + font-size: 12pt; +} +h1 { + font-size: 20pt; + font-weight:bold; +} +h2 { + font-size: 16pt; + font-weight:bold; +} +th { + text-align: left; +} +ul { + margin-bottom: 6pt; +} +</style> +</head> +<body> +<h1><?=$title ?></h1> +<h2>(c) Marcus Börger, 2002</h2> +</p> +<p> +Images taken from <a href="http://www.exif.org">www.exif.org</a>, +<a href="http://marcus-boerger.de">marcus-boerger.de</a> +all rights reserved by their authors and artists, see exif headers. +The files can be downloaded <a href="http://marcus-boerger.de/php/ext/exif/test/">here</a>. +To start the test you simple have to put all images into the same directory as this script. +The test will work with all files in that directory and all subdirectories. To test private +images just put them into that directory. +</p> +<p> +Youmay take a look at the test <a href="http://marcus-boerger.de/php/ext/exif/test.txt">source here</a>. +</p> +<p> +This test just prooves that some exif headers can be scanned. +If all files produce a header in output the module might be o.k. +</p> +<p> +What to look for in detail: +</p> +<ul> +<li>kodak-dc4800-plus-acdsee.jpg + <ul> + <li>should provide a <b>long</b> comment 'by marcus börger<%04i>'*n</li> + <li>this file returns an array but it also produces an errormessage because ACDSee destroys + the integrity of IFD directory (size of directory and offsets of entries following any + edited entry maybe wrong). + </li> + </ul> +</li> +<li>hp-photosmart.jpg + <ul> + <li>should provide a <b>two line</b> copyright notice</li> + </ul> +</li> +<li>olympus-d320l + <ul> + <li>should provide an <b>APP12</b> infoset</li> + </ul> +</li> +<li>unknown.jpg + <ul> + <li>should provide an <b>empty</b> comment, this is a comment section and not an IFD0, EXIF or GPS section</li> + </ul> +</li> +<li>some images + <ul> + <li>have empty fields, that is the tag is present but no data is stored</li> + </ul> +</li> +</ul> +<h2>function exif_tagname</h2> +<table border='1' cellspacing='0' cellpadding='3' summary="EXIF headernames"> +<?php +if (function_exists('exif_tagname')) { +?> +<tr><td>ImageWidth</td><td><?=@exif_tagname(0x0100)?></td><td><?=error_msg()?></td></tr> +<tr><td>JPEGProc</td><td><?=@exif_tagname(0x0200)?></td><td><?=error_msg()?></td></tr> +<tr><td>SceneType</td><td><?=@exif_tagname(0xA301)?></td><td><?=error_msg()?></td></tr> +<tr><td>false</td><td><?=@exif_tagname(0x0000)===false?'false':'value'?></td><td><?=error_msg()?></td></tr> +<?php +} else { + echo "<tr><td>function exif_tagname is not supported</td></tr>\n"; +} +?> +</table> +<br clear="all"> +<h2>function exif_read_data for <?=count($possible)?> images</h2> + +<?php +$check_getimagesize = false; +$check_exif_thumbnail = true; +$check_exif_read_data = false; +$fast_output = false; +if (function_exists('exif_read_data')) { + $num = 0; + echo "<table border='1' cellspacing='0' cellpadding='3' summary='function results'>\n"; + $tab2 = "";//"<table border='1' cellspacing='0' cellpadding='3' summary='EXIF information'>\n"; + $types = array('','GIF','JPEG','PNG','SWF','PSD','BMP','TIFF_II','TIFF_MM','JPC','JP2','JPX','JB2'); + foreach($possible as $idx => $file) { + $type = $file['type']; + $file = $file['file']; + if ( !((++$num)%100)) error_log("exif test page - checking files: $num",0); + $error = ''; + $len = 2; + $rows = 1 + + ($check_getimagesize ? 1 : 0) + + ($check_exif_thumbnail ? 1 : 0) + + ($check_exif_read_data ? 1 : 0); + if ( !$fast_output) echo "<tr><td rowspan='$rows' valign='top'>$num</td><th colspan='2'>$file</th></tr>\n"; + if ($check_getimagesize) { + $len++; + $size = GetImageSize($file); + $error = error_msg();// clear message + if ( $size === false) { + $error = '<b style="color:red">GetImageSize returned false</b><br>'.$error; + $res_getimagesize = $error; + } else { + $res_getimagesize = '('.join($size,',').')'; + } + if ( !$fast_output) echo AddInfo("GetImageSize",$error,1); + } + if ( $check_exif_thumbnail) { + $len++; + if ($type!=IMAGETYPE_JPEG) {// && $type!=IMAGETYPE_TIFF_II && $type!=IMAGETYPE_TIFF_MM) { + $error = "<b style='color: green'>filetype not supported: $types[$type]</b>"; + $res_exif_thumbnail = $error; + } else { + $t_width = 0; + $t_height = 0; + $result = exif_thumbnail($file, $t_width, $t_height); + $error = error_msg();// clear message + if ( $result === false) { + $error = '<b style="color:red">exif_thumbnail returned false</b><br>'.$error; + if ( $t_width && $t_height) { + $error = "<b style='color:green'>$t_width x $t_height</b><br>$error"; + } + $res_exif_thumbnail = $error; + } else { + $res_exif_thumbnail = $t_width . " x " . $t_height; + } + } + if ( !$fast_output) echo AddInfo("exif_thumbnail",$error,1); + } + if ($check_exif_read_data) { + $len++; + if ($type!=IMAGETYPE_JPEG && $type!=IMAGETYPE_TIFF_II && $type!=IMAGETYPE_TIFF_MM) { + $res_exif_read_data = "<b style='color: green'>filetype not supported: $types[$type]</b>"; + if ( !$fast_output) echo AddInfo("exif_read_data",$res_exif_read_data); + $res = ''; + } else { + $image = exif_read_data($file,'COMMENT,IFD0,EXIF,APP12',true); + $error = error_msg();// clear message + if ( !$fast_output) echo AddInfo("exif_read_data",$error,1); + $res = ''; + if ( $image === false) { + $res_exif_read_data = "<b style='color:red'>exif_read_data returned false</b><br>$error"; + } else { + $res_exif_read_data = $error; + // ah no!$error = error_msg(); // force o.k. + foreach($image as $Name => $Value) { + if ( $Name!='Thumbnail') { + if ( is_array($Value)) { + $len++; + $res .= AddInfo($Name,'Array('.count($Value).')'); + foreach( $Value as $idx => $Entry) { + if ($idx==='Thumbnail') $Entry = '<data>'; + $len++; + $res .= AddInfo($Name.':'.$idx,$Entry); + } + } else { + $len++; + $res .= AddInfo($Name,$Value); + } + } + } + } + } + } + $tab2 .= "<tr><td rowspan='$len' valign='top'>$num</td></tr>\n"; + $tab2 .= "<tr><th colspan='2'>$file</th></tr>\n"; + if ($check_getimagesize) { + $tab2 .= "<tr><th>GetImageSize</th><td>$res_getimagesize</td></tr>\n"; + } + if ($check_exif_thumbnail) { + $tab2 .= "<tr><th>exif_thumbnail</th><td>$res_exif_thumbnail</td></tr>\n"; + } + if ($check_exif_read_data) { + $tab2 .= "<tr><th>exif_read_data</th><td>$res_exif_read_data</td></tr>\n"; + $tab2 .= $res; + } + if ( $fast_output) { + echo $tab2; + $tab2 = ''; + } + } + error_log("exif test page - checking files: ".count($possible)." done.",0); + echo $tab2; + echo "</table>\n"; +} else { + echo "<h1 style='color:red'>function exif_read_data is not supported</h1>\n"; +} +?> +</body> +</html>
\ No newline at end of file diff --git a/ext/exif/tests/bug34704.jpg b/ext/exif/tests/bug34704.jpg Binary files differnew file mode 100755 index 0000000..42b14c1 --- /dev/null +++ b/ext/exif/tests/bug34704.jpg diff --git a/ext/exif/tests/bug34704.phpt b/ext/exif/tests/bug34704.phpt new file mode 100644 index 0000000..7688ce8 --- /dev/null +++ b/ext/exif/tests/bug34704.phpt @@ -0,0 +1,42 @@ +--TEST-- +Bug #34704 (Infinite recursion due to corrupt JPEG) +--SKIPIF-- +<?php if (!extension_loaded('exif')) print 'skip exif extension not available';?> +--INI-- +output_handler= +zlib.output_compression=0 +--FILE-- +<?php +$infile = dirname(__FILE__).'/bug34704.jpg'; +var_dump(exif_read_data($infile)); +?> +===DONE=== +--EXPECTF-- +array(7) { + ["FileName"]=> + string(12) "bug34704.jpg" + ["FileDateTime"]=> + int(%d) + ["FileSize"]=> + int(9976) + ["FileType"]=> + int(2) + ["MimeType"]=> + string(10) "image/jpeg" + ["SectionsFound"]=> + string(4) "IFD0" + ["COMPUTED"]=> + array(5) { + ["html"]=> + string(24) "width="386" height="488"" + ["Height"]=> + int(488) + ["Width"]=> + int(386) + ["IsColor"]=> + int(1) + ["ByteOrderMotorola"]=> + int(0) + } +} +===DONE=== diff --git a/ext/exif/tests/bug48378.jpeg b/ext/exif/tests/bug48378.jpeg Binary files differnew file mode 100644 index 0000000..759d805 --- /dev/null +++ b/ext/exif/tests/bug48378.jpeg diff --git a/ext/exif/tests/bug48378.phpt b/ext/exif/tests/bug48378.phpt new file mode 100644 index 0000000..286ce61 --- /dev/null +++ b/ext/exif/tests/bug48378.phpt @@ -0,0 +1,19 @@ +--TEST-- +Bug #48378 (Infinite recursion due to corrupt JPEG) +--SKIPIF-- +<?php if (!extension_loaded('exif')) print 'skip exif extension not available';?> +--FILE-- +<?php +exif_read_data( +dirname(__FILE__) . "/bug48378.jpeg", +"FILE,COMPUTED,ANY_TAG" +); +?> +--EXPECTF-- +Warning: exif_read_data(%s): Invalid IFD start in %s48378.php on line %d + +Warning: exif_read_data(%s): Error reading from file: got=x08B4(=2228) != itemlen-2=x1FFE(=8190) in %s48378.php on line %d + +Warning: exif_read_data(%s): Invalid JPEG file in %s48378.php on line %d + + diff --git a/ext/exif/tests/bug54002.phpt b/ext/exif/tests/bug54002.phpt new file mode 100644 index 0000000..c51fa58 --- /dev/null +++ b/ext/exif/tests/bug54002.phpt @@ -0,0 +1,20 @@ +--TEST-- +Bug #54002 (crash on crafted tag) +--INI-- +memory_limit=-1 +--SKIPIF-- +<?php if (!extension_loaded('exif')) print 'skip exif extension not available';?> +--FILE-- +<?php +exif_read_data(__DIR__ . '/bug54002_1.jpeg'); +exif_read_data(__DIR__ . '/bug54002_2.jpeg'); + +?> +--EXPECTF-- +Warning: exif_read_data(bug54002_1.jpeg): Process tag(x0205=UndefinedTa): Illegal byte_count in %sbug54002.php on line %d + +Warning: exif_read_data(bug54002_1.jpeg): Process tag(xA000=FlashPixVer): Illegal pointer offset(%s) in %sbug54002.php on line %d + +Warning: exif_read_data(bug54002_2.jpeg): Process tag(x0205=UndefinedTa): Illegal byte_count in %sbug54002.php on line %d + +Warning: exif_read_data(bug54002_2.jpeg): Process tag(xA000=FlashPixVer): Illegal pointer offset(%s) in %sbug54002.php on line %d diff --git a/ext/exif/tests/bug54002_1.jpeg b/ext/exif/tests/bug54002_1.jpeg Binary files differnew file mode 100644 index 0000000..a622d6d --- /dev/null +++ b/ext/exif/tests/bug54002_1.jpeg diff --git a/ext/exif/tests/bug54002_2.jpeg b/ext/exif/tests/bug54002_2.jpeg Binary files differnew file mode 100644 index 0000000..a622d6d --- /dev/null +++ b/ext/exif/tests/bug54002_2.jpeg diff --git a/ext/exif/tests/bug60150.jpg b/ext/exif/tests/bug60150.jpg Binary files differnew file mode 100644 index 0000000..2d7d165 --- /dev/null +++ b/ext/exif/tests/bug60150.jpg diff --git a/ext/exif/tests/bug60150.phpt b/ext/exif/tests/bug60150.phpt new file mode 100644 index 0000000..be01998 --- /dev/null +++ b/ext/exif/tests/bug60150.phpt @@ -0,0 +1,21 @@ +--TEST-- +Bug #60150 (Integer overflow during the parsing of invalid exif header) +--SKIPIF-- +<?php if (!extension_loaded('exif')) print 'skip exif extension not available';?> +--INI-- +output_handler= +zlib.output_compression=0 +--FILE-- +<?php +$infile = dirname(__FILE__).'/bug60150.jpg'; +var_dump(exif_read_data($infile)); +?> +===DONE=== +--EXPECTF-- +Warning: exif_read_data(bug60150.jpg): Process tag(x9003=DateTimeOri): Illegal pointer offset(%s) in %s on line %d + +Warning: exif_read_data(bug60150.jpg): Error reading from file: got=x%x(=%d) != itemlen-%d=x%x(=%d) in %s on line %d + +Warning: exif_read_data(bug60150.jpg): Invalid JPEG file in %s on line %d +bool(false) +===DONE=== diff --git a/ext/exif/tests/exif000.phpt b/ext/exif/tests/exif000.phpt new file mode 100644 index 0000000..eea1643 --- /dev/null +++ b/ext/exif/tests/exif000.phpt @@ -0,0 +1,57 @@ +--TEST-- +Check for exif_read_data default behaviour +--SKIPIF-- +<?php if (!extension_loaded('exif')) print 'skip exif extension not available';?> +--INI-- +output_handler= +zlib.output_compression=0 +--FILE-- +<?php +/* + test1.jpg is a 1*1 image that does not contain any Exif/Comment information + test2.jpg is the same image but contains Exif/Comment information and a + copy of test1.jpg as a thumbnail. +*/ +print_r(exif_read_data(dirname(__FILE__).'/test2.jpg')); +?> +--EXPECTF-- +Array +( + [FileName] => test2.jpg + [FileDateTime] => %d + [FileSize] => 1240 + [FileType] => 2 + [MimeType] => image/jpeg + [SectionsFound] => ANY_TAG, IFD0, THUMBNAIL, COMMENT + [COMPUTED] => Array + ( + [html] => width="1" height="1" + [Height] => 1 + [Width] => 1 + [IsColor] => 1 + [ByteOrderMotorola] => 1 + [UserComment] => Exif test image. + [UserCommentEncoding] => ASCII + [Copyright] => Photo (c) M.Boerger, Edited by M.Boerger. + [Copyright.Photographer] => Photo (c) M.Boerger + [Copyright.Editor] => Edited by M.Boerger. + [Thumbnail.FileType] => 2 + [Thumbnail.MimeType] => image/jpeg + ) + + [Copyright] => Photo (c) M.Boerger + [UserComment] => ASCII + [THUMBNAIL] => Array + ( + [JPEGInterchangeFormat] => 134 + [JPEGInterchangeFormatLength] => 523 + ) + + [COMMENT] => Array + ( + [0] => Comment #1. + [1] => Comment #2. + [2] => Comment #3end + ) + +) diff --git a/ext/exif/tests/exif001.phpt b/ext/exif/tests/exif001.phpt new file mode 100644 index 0000000..8fac428 --- /dev/null +++ b/ext/exif/tests/exif001.phpt @@ -0,0 +1,84 @@ +--TEST-- +Check for exif_read_data +--SKIPIF-- +<?php if (!extension_loaded('exif')) print 'skip exif extension not available';?> +--INI-- +output_handler= +zlib.output_compression=0 +--FILE-- +<?php +/* + test1.jpg is a 1*1 image that does not contain any Exif/Comment information + test2.jpg is the same image but contains Exif/Comment information and a + copy of test1.jpg as a thumbnail. +*/ +var_dump(exif_read_data(dirname(__FILE__).'/test2.jpg','',true,false)); +?> +--EXPECTF-- +array(5) { + ["FILE"]=> + array(6) { + ["FileName"]=> + string(9) "test2.jpg" + ["FileDateTime"]=> + int(%d) + ["FileSize"]=> + int(1240) + ["FileType"]=> + int(2) + ["MimeType"]=> + string(10) "image/jpeg" + ["SectionsFound"]=> + string(33) "ANY_TAG, IFD0, THUMBNAIL, COMMENT" + } + ["COMPUTED"]=> + array(12) { + ["html"]=> + string(20) "width="1" height="1"" + ["Height"]=> + int(1) + ["Width"]=> + int(1) + ["IsColor"]=> + int(1) + ["ByteOrderMotorola"]=> + int(1) + ["UserComment"]=> + string(16) "Exif test image." + ["UserCommentEncoding"]=> + string(5) "ASCII" + ["Copyright"]=> + string(41) "Photo (c) M.Boerger, Edited by M.Boerger." + ["Copyright.Photographer"]=> + string(19) "Photo (c) M.Boerger" + ["Copyright.Editor"]=> + string(20) "Edited by M.Boerger." + ["Thumbnail.FileType"]=> + int(2) + ["Thumbnail.MimeType"]=> + string(10) "image/jpeg" + } + ["IFD0"]=> + array(2) { + ["Copyright"]=> + string(19) "Photo (c) M.Boerger" + ["UserComment"]=> + string(5) "ASCII" + } + ["THUMBNAIL"]=> + array(2) { + ["JPEGInterchangeFormat"]=> + int(134) + ["JPEGInterchangeFormatLength"]=> + int(523) + } + ["COMMENT"]=> + array(3) { + [0]=> + string(11) "Comment #1." + [1]=> + string(11) "Comment #2." + [2]=> + string(13) "Comment #3end" + } +}
\ No newline at end of file diff --git a/ext/exif/tests/exif002.phpt b/ext/exif/tests/exif002.phpt new file mode 100644 index 0000000..2a70f29 --- /dev/null +++ b/ext/exif/tests/exif002.phpt @@ -0,0 +1,23 @@ +--TEST-- +Check for exif_thumbnail +--SKIPIF-- +<?php if (!extension_loaded('exif')) print 'skip exif extension not available';?> +--INI-- +output_handler= +zlib.output_compression=0 +--FILE-- +<?php +/* + test1.jpg is a 1*1 image that does not contain any Exif/Comment information + test2.jpg is the same image but contains Exif/Comment information and a + copy of test1.jpg as a thumbnail. +*/ +$infile = dirname(__FILE__).'/test1.jpg'; +echo md5_file($infile).'_'.filesize($infile); +$thumb = exif_thumbnail(dirname(__FILE__).'/test2.jpg'); +echo " == "; +echo md5($thumb).'_'.strlen($thumb); +echo "\n"; +?> +--EXPECT-- +27bbfd9fc10e1e663d749f5225447905_523 == 27bbfd9fc10e1e663d749f5225447905_523 diff --git a/ext/exif/tests/exif003.phpt b/ext/exif/tests/exif003.phpt new file mode 100644 index 0000000..20cb61e --- /dev/null +++ b/ext/exif/tests/exif003.phpt @@ -0,0 +1,91 @@ +--TEST-- +Check for exif_read_data, Unicode user comment +--SKIPIF-- +<?php + if (!extension_loaded('exif')) die('skip exif extension not available'); + if (!extension_loaded('mbstring')) die('skip mbstring extension not available'); + if (!defined("EXIF_USE_MBSTRING") || !EXIF_USE_MBSTRING) die ('skip mbstring loaded by dl'); +?> +--INI-- +output_handler= +zlib.output_compression=0 +exif.decode_unicode_motorola=UCS-2BE +exif.encode_unicode=ISO-8859-15 +--FILE-- +<?php +/* + test1.jpg is a 1*1 image that does not contain any Exif/Comment information + test2.jpg is the same image but contains Exif/Comment information and a + copy of test1.jpg as a thumbnail. + test3.jpg is the same as test2.jpg but with a UNICODE UserComment: ÄÖ&Üßäöü +*/ +var_dump(exif_read_data(dirname(__FILE__).'/test3.jpg','',true,false)); +?> +--EXPECTF-- +array(5) { + ["FILE"]=> + array(6) { + ["FileName"]=> + string(9) "test3.jpg" + ["FileDateTime"]=> + int(%s) + ["FileSize"]=> + int(1240) + ["FileType"]=> + int(2) + ["MimeType"]=> + string(10) "image/jpeg" + ["SectionsFound"]=> + string(33) "ANY_TAG, IFD0, THUMBNAIL, COMMENT" + } + ["COMPUTED"]=> + array(12) { + ["html"]=> + string(20) "width="1" height="1"" + ["Height"]=> + int(1) + ["Width"]=> + int(1) + ["IsColor"]=> + int(1) + ["ByteOrderMotorola"]=> + int(1) + ["UserComment"]=> + string(7) "ÄÖÜßäöü" + ["UserCommentEncoding"]=> + string(7) "UNICODE" + ["Copyright"]=> + string(41) "Photo (c) M.Boerger, Edited by M.Boerger." + ["Copyright.Photographer"]=> + string(19) "Photo (c) M.Boerger" + ["Copyright.Editor"]=> + string(20) "Edited by M.Boerger." + ["Thumbnail.FileType"]=> + int(2) + ["Thumbnail.MimeType"]=> + string(10) "image/jpeg" + } + ["IFD0"]=> + array(2) { + ["Copyright"]=> + string(19) "Photo (c) M.Boerger" + ["UserComment"]=> + string(7) "UNICODE" + } + ["THUMBNAIL"]=> + array(2) { + ["JPEGInterchangeFormat"]=> + int(134) + ["JPEGInterchangeFormatLength"]=> + int(523) + } + ["COMMENT"]=> + array(3) { + [0]=> + string(11) "Comment #1." + [1]=> + string(11) "Comment #2." + [2]=> + string(13) "Comment #3end" + } +}
\ No newline at end of file diff --git a/ext/exif/tests/exif004.phpt b/ext/exif/tests/exif004.phpt new file mode 100644 index 0000000..229f49e --- /dev/null +++ b/ext/exif/tests/exif004.phpt @@ -0,0 +1,38 @@ +--TEST-- +Check for exif_read_data, Unicode WinXP tags +--SKIPIF-- +<?php + if (!extension_loaded('exif')) die('skip exif extension not available'); + if (!extension_loaded('mbstring')) die('skip mbstring extension not available'); + if (!defined("EXIF_USE_MBSTRING") || !EXIF_USE_MBSTRING) die ('skip mbstring loaded by dl'); +?> +--INI-- +output_handler= +zlib.output_compression=0 +exif.decode_unicode_intel=UCS-2LE +exif.decode_unicode_motorola=UCS-2BE +exif.encode_unicode=ISO-8859-1 +--FILE-- +<?php +/* + test4.jpg is a 1*1 image that contains Exif tags written by WindowsXP +*/ +$image = exif_read_data(dirname(__FILE__).'/test4.jpg','',true,false); +echo var_dump($image['WINXP']); +?> +--EXPECT-- +array(5) { + ["Subject"]=> + string(10) "Subject..." + ["Keywords"]=> + string(11) "Keywords..." + ["Author"]=> + string(9) "Rui Carmo" + ["Comments"]=> + string(29) "Comments +Line2 +Line3 +Line4" + ["Title"]=> + string(8) "Title..." +} diff --git a/ext/exif/tests/exif005.phpt b/ext/exif/tests/exif005.phpt new file mode 100644 index 0000000..e34e3a0 --- /dev/null +++ b/ext/exif/tests/exif005.phpt @@ -0,0 +1,22 @@ +--TEST-- +Check for exif_read_data, unusual IFD start +--SKIPIF-- +<?php if (!extension_loaded('exif')) print 'skip exif extension not available';?> +--INI-- +output_handler= +zlib.output_compression=0 +--FILE-- +<?php +/* Do not change this test it is a README.TESTING example. + * test5.jpg is a 1*1 image that contains an Exif section with ifd = 00000009h + */ +$image = exif_read_data(dirname(__FILE__).'/test5.jpg','',true,false); +var_dump($image['IFD0']); +?> +--EXPECT-- +array(2) { + ["ImageDescription"]=> + string(11) "Ifd00000009" + ["DateTime"]=> + string(19) "2002:10:18 20:06:00" +}
\ No newline at end of file diff --git a/ext/exif/tests/exif007.phpt b/ext/exif/tests/exif007.phpt new file mode 100644 index 0000000..8e82fe5 --- /dev/null +++ b/ext/exif/tests/exif007.phpt @@ -0,0 +1,39 @@ +--TEST-- +Check for exif_read_data, baseline JPEG with no IFD, EXIF, GPS or Interoperability data in Intel byte-order. +--SKIPIF-- +<?php if (!extension_loaded('exif')) print 'skip exif extension not available';?> +--INI-- +output_handler= +zlib.output_compression=0 +--FILE-- +<?php +var_dump(exif_read_data(dirname(__FILE__).'/image007.jpg')); +?> +--EXPECTF-- +array(7) { + ["FileName"]=> + string(12) "image007.jpg" + ["FileDateTime"]=> + int(%d) + ["FileSize"]=> + int(%d) + ["FileType"]=> + int(2) + ["MimeType"]=> + string(10) "image/jpeg" + ["SectionsFound"]=> + string(0) "" + ["COMPUTED"]=> + array(4) { + ["html"]=> + string(20) "width="1" height="1"" + ["Height"]=> + int(1) + ["Width"]=> + int(1) + ["IsColor"]=> + int(1) + } +} +--CREDIT-- +Eric Stewart <ericleestewart@gmail.com> diff --git a/ext/exif/tests/exif008.phpt b/ext/exif/tests/exif008.phpt new file mode 100644 index 0000000..01da06e --- /dev/null +++ b/ext/exif/tests/exif008.phpt @@ -0,0 +1,65 @@ +--TEST-- +Check for exif_read_data, JPEG with IFD data in Intel byte-order. +--SKIPIF-- +<?php if (!extension_loaded('exif')) print 'skip exif extension not available';?> +--INI-- +output_handler= +zlib.output_compression=0 +--FILE-- +<?php +var_dump(exif_read_data(dirname(__FILE__).'/image008.jpg')); +?> +--EXPECTF-- +array(16) { + ["FileName"]=> + string(12) "image008.jpg" + ["FileDateTime"]=> + int(%d) + ["FileSize"]=> + int(%d) + ["FileType"]=> + int(2) + ["MimeType"]=> + string(10) "image/jpeg" + ["SectionsFound"]=> + string(13) "ANY_TAG, IFD0" + ["COMPUTED"]=> + array(8) { + ["html"]=> + string(20) "width="1" height="1"" + ["Height"]=> + int(1) + ["Width"]=> + int(1) + ["IsColor"]=> + int(1) + ["ByteOrderMotorola"]=> + int(0) + ["Copyright"]=> + string(24) "Eric Stewart, Hex Editor" + ["Copyright.Photographer"]=> + string(12) "Eric Stewart" + ["Copyright.Editor"]=> + string(10) "Hex Editor" + } + ["ImageDescription"]=> + string(15) "My description." + ["Make"]=> + string(11) "OpenShutter" + ["Model"]=> + string(8) "OS 1.0.0" + ["XResolution"]=> + string(4) "72/1" + ["YResolution"]=> + string(4) "72/1" + ["ResolutionUnit"]=> + int(2) + ["DateTime"]=> + string(19) "2008:06:19 01:47:53" + ["Artist"]=> + string(12) "Eric Stewart" + ["Copyright"]=> + string(12) "Eric Stewart" +} +--CREDIT-- +Eric Stewart <ericleestewart@gmail.com> diff --git a/ext/exif/tests/exif009.phpt b/ext/exif/tests/exif009.phpt new file mode 100644 index 0000000..e2025e4 --- /dev/null +++ b/ext/exif/tests/exif009.phpt @@ -0,0 +1,65 @@ +--TEST-- +Check for exif_read_data, JPEG with IFD data in Motorola byte-order. +--SKIPIF-- +<?php if (!extension_loaded('exif')) print 'skip exif extension not available';?> +--INI-- +output_handler= +zlib.output_compression=0 +--FILE-- +<?php +var_dump(exif_read_data(dirname(__FILE__).'/image009.jpg')); +?> +--EXPECTF-- +array(16) { + ["FileName"]=> + string(12) "image009.jpg" + ["FileDateTime"]=> + int(%d) + ["FileSize"]=> + int(%d) + ["FileType"]=> + int(2) + ["MimeType"]=> + string(10) "image/jpeg" + ["SectionsFound"]=> + string(13) "ANY_TAG, IFD0" + ["COMPUTED"]=> + array(8) { + ["html"]=> + string(20) "width="1" height="1"" + ["Height"]=> + int(1) + ["Width"]=> + int(1) + ["IsColor"]=> + int(1) + ["ByteOrderMotorola"]=> + int(1) + ["Copyright"]=> + string(24) "Eric Stewart, Hex Editor" + ["Copyright.Photographer"]=> + string(12) "Eric Stewart" + ["Copyright.Editor"]=> + string(10) "Hex Editor" + } + ["ImageDescription"]=> + string(15) "My description." + ["Make"]=> + string(11) "OpenShutter" + ["Model"]=> + string(8) "OS 1.0.0" + ["XResolution"]=> + string(4) "72/1" + ["YResolution"]=> + string(4) "72/1" + ["ResolutionUnit"]=> + int(2) + ["DateTime"]=> + string(19) "2008:06:19 01:47:53" + ["Artist"]=> + string(12) "Eric Stewart" + ["Copyright"]=> + string(12) "Eric Stewart" +} +--CREDIT-- +Eric Stewart <ericleestewart@gmail.com> diff --git a/ext/exif/tests/exif010.phpt b/ext/exif/tests/exif010.phpt new file mode 100644 index 0000000..45a2617 --- /dev/null +++ b/ext/exif/tests/exif010.phpt @@ -0,0 +1,91 @@ +--TEST-- +Check for exif_read_data, JPEG with IFD and EXIF data in Intel byte-order. +--SKIPIF-- +<?php if (!extension_loaded('exif')) print 'skip exif extension not available';?> +--INI-- +output_handler= +zlib.output_compression=0 +--FILE-- +<?php +var_dump(exif_read_data(dirname(__FILE__).'/image010.jpg')); +?> +--EXPECTF-- +array(28) { + ["FileName"]=> + string(12) "image010.jpg" + ["FileDateTime"]=> + int(%d) + ["FileSize"]=> + int(%d) + ["FileType"]=> + int(2) + ["MimeType"]=> + string(10) "image/jpeg" + ["SectionsFound"]=> + string(19) "ANY_TAG, IFD0, EXIF" + ["COMPUTED"]=> + array(9) { + ["html"]=> + string(20) "width="1" height="1"" + ["Height"]=> + int(1) + ["Width"]=> + int(1) + ["IsColor"]=> + int(1) + ["ByteOrderMotorola"]=> + int(0) + ["ApertureFNumber"]=> + string(5) "f/8.0" + ["Copyright"]=> + string(24) "Eric Stewart, Hex Editor" + ["Copyright.Photographer"]=> + string(12) "Eric Stewart" + ["Copyright.Editor"]=> + string(10) "Hex Editor" + } + ["ImageDescription"]=> + string(15) "My description." + ["Make"]=> + string(11) "OpenShutter" + ["Model"]=> + string(8) "OS 1.0.0" + ["XResolution"]=> + string(4) "72/1" + ["YResolution"]=> + string(4) "72/1" + ["ResolutionUnit"]=> + int(2) + ["DateTime"]=> + string(19) "2008:06:19 01:47:53" + ["Artist"]=> + string(12) "Eric Stewart" + ["Copyright"]=> + string(12) "Eric Stewart" + ["Exif_IFD_Pointer"]=> + int(246) + ["ExposureTime"]=> + string(5) "1/125" + ["FNumber"]=> + string(3) "8/1" + ["ISOSpeedRatings"]=> + int(80) + ["DateTimeOriginal"]=> + string(19) "2008:06:19 01:47:53" + ["DateTimeDigitized"]=> + string(19) "2008:06:19 01:47:53" + ["MeteringMode"]=> + int(5) + ["LightSource"]=> + int(4) + ["Flash"]=> + int(7) + ["FocalLength"]=> + string(4) "29/5" + ["ExifImageWidth"]=> + int(1) + ["ExifImageLength"]=> + int(1) +} +--CREDIT-- +Eric Stewart <ericleestewart@gmail.com> diff --git a/ext/exif/tests/exif011.phpt b/ext/exif/tests/exif011.phpt new file mode 100644 index 0000000..adaf246 --- /dev/null +++ b/ext/exif/tests/exif011.phpt @@ -0,0 +1,91 @@ +--TEST-- +Check for exif_read_data, JPEG with IFD and EXIF data in Motorola byte-order. +--SKIPIF-- +<?php if (!extension_loaded('exif')) print 'skip exif extension not available';?> +--INI-- +output_handler= +zlib.output_compression=0 +--FILE-- +<?php +var_dump(exif_read_data(dirname(__FILE__).'/image011.jpg')); +?> +--EXPECTF-- +array(28) { + ["FileName"]=> + string(12) "image011.jpg" + ["FileDateTime"]=> + int(%d) + ["FileSize"]=> + int(%d) + ["FileType"]=> + int(2) + ["MimeType"]=> + string(10) "image/jpeg" + ["SectionsFound"]=> + string(19) "ANY_TAG, IFD0, EXIF" + ["COMPUTED"]=> + array(9) { + ["html"]=> + string(20) "width="1" height="1"" + ["Height"]=> + int(1) + ["Width"]=> + int(1) + ["IsColor"]=> + int(1) + ["ByteOrderMotorola"]=> + int(1) + ["ApertureFNumber"]=> + string(5) "f/8.0" + ["Copyright"]=> + string(24) "Eric Stewart, Hex Editor" + ["Copyright.Photographer"]=> + string(12) "Eric Stewart" + ["Copyright.Editor"]=> + string(10) "Hex Editor" + } + ["ImageDescription"]=> + string(15) "My description." + ["Make"]=> + string(11) "OpenShutter" + ["Model"]=> + string(8) "OS 1.0.0" + ["XResolution"]=> + string(4) "72/1" + ["YResolution"]=> + string(4) "72/1" + ["ResolutionUnit"]=> + int(2) + ["DateTime"]=> + string(19) "2008:06:19 01:47:53" + ["Artist"]=> + string(12) "Eric Stewart" + ["Copyright"]=> + string(12) "Eric Stewart" + ["Exif_IFD_Pointer"]=> + int(246) + ["ExposureTime"]=> + string(5) "1/125" + ["FNumber"]=> + string(3) "8/1" + ["ISOSpeedRatings"]=> + int(80) + ["DateTimeOriginal"]=> + string(19) "2008:06:19 01:47:53" + ["DateTimeDigitized"]=> + string(19) "2008:06:19 01:47:53" + ["MeteringMode"]=> + int(5) + ["LightSource"]=> + int(4) + ["Flash"]=> + int(7) + ["FocalLength"]=> + string(4) "29/5" + ["ExifImageWidth"]=> + int(1) + ["ExifImageLength"]=> + int(1) +} +--CREDIT-- +Eric Stewart <ericleestewart@gmail.com> diff --git a/ext/exif/tests/exif012.phpt b/ext/exif/tests/exif012.phpt Binary files differnew file mode 100644 index 0000000..8e8b01a --- /dev/null +++ b/ext/exif/tests/exif012.phpt diff --git a/ext/exif/tests/exif013.phpt b/ext/exif/tests/exif013.phpt Binary files differnew file mode 100644 index 0000000..88dc881 --- /dev/null +++ b/ext/exif/tests/exif013.phpt diff --git a/ext/exif/tests/exif014.phpt b/ext/exif/tests/exif014.phpt Binary files differnew file mode 100644 index 0000000..4a4df12 --- /dev/null +++ b/ext/exif/tests/exif014.phpt diff --git a/ext/exif/tests/exif015.phpt b/ext/exif/tests/exif015.phpt Binary files differnew file mode 100644 index 0000000..c38ef4e --- /dev/null +++ b/ext/exif/tests/exif015.phpt diff --git a/ext/exif/tests/exif016.phpt b/ext/exif/tests/exif016.phpt new file mode 100644 index 0000000..266801b --- /dev/null +++ b/ext/exif/tests/exif016.phpt @@ -0,0 +1,1622 @@ +--TEST-- +Check for exif_read_data, TIFF with IFD data in Intel byte-order. +--SKIPIF-- +<?php if (!extension_loaded('exif')) print 'skip exif extension not available';?> +--INI-- +output_handler= +zlib.output_compression=0 +--FILE-- +<?php +var_dump(exif_read_data(dirname(__FILE__).'/image016.tiff')); +?> +--EXPECTF-- +array(26) { + ["FileName"]=> + string(13) "image016.tiff" + ["FileDateTime"]=> + int(%d) + ["FileSize"]=> + int(%d) + ["FileType"]=> + int(7) + ["MimeType"]=> + string(10) "image/tiff" + ["SectionsFound"]=> + string(13) "ANY_TAG, IFD0" + ["COMPUTED"]=> + array(8) { + ["html"]=> + string(20) "width="1" height="1"" + ["Height"]=> + int(1) + ["Width"]=> + int(1) + ["IsColor"]=> + int(1) + ["ByteOrderMotorola"]=> + int(0) + ["Copyright"]=> + string(24) "Eric Stewart, Hex Editor" + ["Copyright.Photographer"]=> + string(12) "Eric Stewart" + ["Copyright.Editor"]=> + string(10) "Hex Editor" + } + ["ImageWidth"]=> + int(1) + ["ImageLength"]=> + int(1) + ["BitsPerSample"]=> + int(8) + ["Compression"]=> + int(5) + ["PhotometricInterpretation"]=> + int(3) + ["ImageDescription"]=> + string(15) "My description." + ["Make"]=> + string(11) "OpenShutter" + ["Model"]=> + string(8) "OS 1.0.0" + ["StripOffsets"]=> + int(1870) + ["SamplesPerPixel"]=> + int(1) + ["RowsPerStrip"]=> + int(8) + ["StripByteCounts"]=> + int(4) + ["XResolution"]=> + string(17) "381681664/2097152" + ["YResolution"]=> + string(17) "381681664/2097152" + ["PlanarConfiguration"]=> + int(1) + ["ResolutionUnit"]=> + int(2) + ["Artist"]=> + string(12) "Eric Stewart" + ["ColorMap"]=> + array(768) { + [0]=> + int(0) + [1]=> + int(65280) + [2]=> + int(32512) + [3]=> + int(49152) + [4]=> + int(99) + [5]=> + int(115) + [6]=> + int(116) + [7]=> + int(101) + [8]=> + int(119) + [9]=> + int(97) + [10]=> + int(114) + [11]=> + int(116) + [12]=> + int(0) + [13]=> + int(0) + [14]=> + int(0) + [15]=> + int(0) + [16]=> + int(0) + [17]=> + int(0) + [18]=> + int(0) + [19]=> + int(0) + [20]=> + int(0) + [21]=> + int(0) + [22]=> + int(0) + [23]=> + int(0) + [24]=> + int(0) + [25]=> + int(0) + [26]=> + int(0) + [27]=> + int(0) + [28]=> + int(0) + [29]=> + int(0) + [30]=> + int(0) + [31]=> + int(0) + [32]=> + int(0) + [33]=> + int(0) + [34]=> + int(0) + [35]=> + int(0) + [36]=> + int(0) + [37]=> + int(0) + [38]=> + int(0) + [39]=> + int(0) + [40]=> + int(0) + [41]=> + int(0) + [42]=> + int(0) + [43]=> + int(0) + [44]=> + int(0) + [45]=> + int(0) + [46]=> + int(0) + [47]=> + int(0) + [48]=> + int(0) + [49]=> + int(0) + [50]=> + int(0) + [51]=> + int(0) + [52]=> + int(0) + [53]=> + int(0) + [54]=> + int(0) + [55]=> + int(0) + [56]=> + int(0) + [57]=> + int(0) + [58]=> + int(0) + [59]=> + int(0) + [60]=> + int(0) + [61]=> + int(0) + [62]=> + int(0) + [63]=> + int(0) + [64]=> + int(0) + [65]=> + int(0) + [66]=> + int(0) + [67]=> + int(0) + [68]=> + int(0) + [69]=> + int(0) + [70]=> + int(0) + [71]=> + int(0) + [72]=> + int(0) + [73]=> + int(0) + [74]=> + int(0) + [75]=> + int(0) + [76]=> + int(0) + [77]=> + int(0) + [78]=> + int(0) + [79]=> + int(0) + [80]=> + int(0) + [81]=> + int(0) + [82]=> + int(0) + [83]=> + int(0) + [84]=> + int(0) + [85]=> + int(0) + [86]=> + int(0) + [87]=> + int(0) + [88]=> + int(0) + [89]=> + int(0) + [90]=> + int(0) + [91]=> + int(0) + [92]=> + int(0) + [93]=> + int(0) + [94]=> + int(0) + [95]=> + int(0) + [96]=> + int(0) + [97]=> + int(0) + [98]=> + int(0) + [99]=> + int(0) + [100]=> + int(0) + [101]=> + int(0) + [102]=> + int(0) + [103]=> + int(0) + [104]=> + int(0) + [105]=> + int(0) + [106]=> + int(0) + [107]=> + int(0) + [108]=> + int(0) + [109]=> + int(0) + [110]=> + int(0) + [111]=> + int(0) + [112]=> + int(0) + [113]=> + int(0) + [114]=> + int(0) + [115]=> + int(0) + [116]=> + int(0) + [117]=> + int(0) + [118]=> + int(0) + [119]=> + int(0) + [120]=> + int(0) + [121]=> + int(0) + [122]=> + int(0) + [123]=> + int(0) + [124]=> + int(0) + [125]=> + int(0) + [126]=> + int(0) + [127]=> + int(0) + [128]=> + int(0) + [129]=> + int(0) + [130]=> + int(0) + [131]=> + int(0) + [132]=> + int(0) + [133]=> + int(0) + [134]=> + int(0) + [135]=> + int(0) + [136]=> + int(0) + [137]=> + int(0) + [138]=> + int(0) + [139]=> + int(0) + [140]=> + int(0) + [141]=> + int(0) + [142]=> + int(0) + [143]=> + int(0) + [144]=> + int(0) + [145]=> + int(0) + [146]=> + int(0) + [147]=> + int(0) + [148]=> + int(0) + [149]=> + int(0) + [150]=> + int(0) + [151]=> + int(0) + [152]=> + int(0) + [153]=> + int(0) + [154]=> + int(0) + [155]=> + int(0) + [156]=> + int(0) + [157]=> + int(0) + [158]=> + int(0) + [159]=> + int(0) + [160]=> + int(0) + [161]=> + int(0) + [162]=> + int(0) + [163]=> + int(0) + [164]=> + int(0) + [165]=> + int(0) + [166]=> + int(0) + [167]=> + int(0) + [168]=> + int(0) + [169]=> + int(0) + [170]=> + int(0) + [171]=> + int(0) + [172]=> + int(0) + [173]=> + int(0) + [174]=> + int(0) + [175]=> + int(0) + [176]=> + int(0) + [177]=> + int(0) + [178]=> + int(0) + [179]=> + int(0) + [180]=> + int(0) + [181]=> + int(0) + [182]=> + int(0) + [183]=> + int(0) + [184]=> + int(0) + [185]=> + int(0) + [186]=> + int(0) + [187]=> + int(0) + [188]=> + int(0) + [189]=> + int(0) + [190]=> + int(0) + [191]=> + int(0) + [192]=> + int(0) + [193]=> + int(0) + [194]=> + int(0) + [195]=> + int(0) + [196]=> + int(0) + [197]=> + int(0) + [198]=> + int(0) + [199]=> + int(0) + [200]=> + int(0) + [201]=> + int(0) + [202]=> + int(0) + [203]=> + int(0) + [204]=> + int(0) + [205]=> + int(0) + [206]=> + int(0) + [207]=> + int(0) + [208]=> + int(0) + [209]=> + int(0) + [210]=> + int(0) + [211]=> + int(0) + [212]=> + int(0) + [213]=> + int(0) + [214]=> + int(0) + [215]=> + int(0) + [216]=> + int(0) + [217]=> + int(0) + [218]=> + int(0) + [219]=> + int(0) + [220]=> + int(0) + [221]=> + int(0) + [222]=> + int(0) + [223]=> + int(0) + [224]=> + int(0) + [225]=> + int(0) + [226]=> + int(0) + [227]=> + int(0) + [228]=> + int(0) + [229]=> + int(0) + [230]=> + int(0) + [231]=> + int(0) + [232]=> + int(0) + [233]=> + int(0) + [234]=> + int(0) + [235]=> + int(0) + [236]=> + int(0) + [237]=> + int(0) + [238]=> + int(0) + [239]=> + int(0) + [240]=> + int(0) + [241]=> + int(0) + [242]=> + int(0) + [243]=> + int(0) + [244]=> + int(0) + [245]=> + int(0) + [246]=> + int(0) + [247]=> + int(0) + [248]=> + int(0) + [249]=> + int(0) + [250]=> + int(0) + [251]=> + int(0) + [252]=> + int(0) + [253]=> + int(0) + [254]=> + int(0) + [255]=> + int(1) + [256]=> + int(0) + [257]=> + int(65280) + [258]=> + int(32512) + [259]=> + int(49152) + [260]=> + int(0) + [261]=> + int(0) + [262]=> + int(0) + [263]=> + int(0) + [264]=> + int(0) + [265]=> + int(0) + [266]=> + int(0) + [267]=> + int(0) + [268]=> + int(0) + [269]=> + int(0) + [270]=> + int(0) + [271]=> + int(0) + [272]=> + int(11945) + [273]=> + int(1914) + [274]=> + int(0) + [275]=> + int(24609) + [276]=> + int(1088) + [277]=> + int(960) + [278]=> + int(0) + [279]=> + int(0) + [280]=> + int(20000) + [281]=> + int(8414) + [282]=> + int(65436) + [283]=> + int(0) + [284]=> + int(47655) + [285]=> + int(8) + [286]=> + int(37936) + [287]=> + int(8406) + [288]=> + int(0) + [289]=> + int(0) + [290]=> + int(0) + [291]=> + int(0) + [292]=> + int(0) + [293]=> + int(0) + [294]=> + int(0) + [295]=> + int(0) + [296]=> + int(0) + [297]=> + int(64652) + [298]=> + int(50264) + [299]=> + int(0) + [300]=> + int(0) + [301]=> + int(64887) + [302]=> + int(50264) + [303]=> + int(0) + [304]=> + int(25714) + [305]=> + int(26220) + [306]=> + int(17235) + [307]=> + int(19777) + [308]=> + int(65535) + [309]=> + int(65535) + [310]=> + int(65535) + [311]=> + int(65535) + [312]=> + int(65535) + [313]=> + int(65535) + [314]=> + int(65535) + [315]=> + int(65535) + [316]=> + int(501) + [317]=> + int(0) + [318]=> + int(20) + [319]=> + int(0) + [320]=> + int(0) + [321]=> + int(0) + [322]=> + int(16877) + [323]=> + int(0) + [324]=> + int(3) + [325]=> + int(0) + [326]=> + int(0) + [327]=> + int(0) + [328]=> + int(0) + [329]=> + int(0) + [330]=> + int(0) + [331]=> + int(0) + [332]=> + int(65535) + [333]=> + int(65535) + [334]=> + int(65535) + [335]=> + int(65535) + [336]=> + int(65535) + [337]=> + int(65535) + [338]=> + int(65535) + [339]=> + int(65535) + [340]=> + int(0) + [341]=> + int(0) + [342]=> + int(52840) + [343]=> + int(2025) + [344]=> + int(16) + [345]=> + int(57377) + [346]=> + int(1024) + [347]=> + int(960) + [348]=> + int(0) + [349]=> + int(0) + [350]=> + int(27136) + [351]=> + int(8414) + [352]=> + int(65436) + [353]=> + int(0) + [354]=> + int(47655) + [355]=> + int(8) + [356]=> + int(62400) + [357]=> + int(8407) + [358]=> + int(0) + [359]=> + int(0) + [360]=> + int(0) + [361]=> + int(0) + [362]=> + int(0) + [363]=> + int(0) + [364]=> + int(0) + [365]=> + int(0) + [366]=> + int(0) + [367]=> + int(64857) + [368]=> + int(50264) + [369]=> + int(0) + [370]=> + int(0) + [371]=> + int(64892) + [372]=> + int(50264) + [373]=> + int(0) + [374]=> + int(25714) + [375]=> + int(26220) + [376]=> + int(17235) + [377]=> + int(19777) + [378]=> + int(65535) + [379]=> + int(65535) + [380]=> + int(65535) + [381]=> + int(65535) + [382]=> + int(65535) + [383]=> + int(65535) + [384]=> + int(65535) + [385]=> + int(65535) + [386]=> + int(501) + [387]=> + int(0) + [388]=> + int(20) + [389]=> + int(0) + [390]=> + int(0) + [391]=> + int(0) + [392]=> + int(16877) + [393]=> + int(0) + [394]=> + int(3) + [395]=> + int(0) + [396]=> + int(0) + [397]=> + int(0) + [398]=> + int(0) + [399]=> + int(0) + [400]=> + int(0) + [401]=> + int(0) + [402]=> + int(65535) + [403]=> + int(65535) + [404]=> + int(65535) + [405]=> + int(65535) + [406]=> + int(65535) + [407]=> + int(65535) + [408]=> + int(65535) + [409]=> + int(65535) + [410]=> + int(0) + [411]=> + int(0) + [412]=> + int(53440) + [413]=> + int(2025) + [414]=> + int(16) + [415]=> + int(57377) + [416]=> + int(1024) + [417]=> + int(960) + [418]=> + int(0) + [419]=> + int(0) + [420]=> + int(41120) + [421]=> + int(9024) + [422]=> + int(65436) + [423]=> + int(0) + [424]=> + int(47655) + [425]=> + int(8) + [426]=> + int(24480) + [427]=> + int(8404) + [428]=> + int(0) + [429]=> + int(0) + [430]=> + int(0) + [431]=> + int(0) + [432]=> + int(0) + [433]=> + int(0) + [434]=> + int(0) + [435]=> + int(0) + [436]=> + int(0) + [437]=> + int(21315) + [438]=> + int(50294) + [439]=> + int(0) + [440]=> + int(0) + [441]=> + int(53635) + [442]=> + int(50294) + [443]=> + int(0) + [444]=> + int(25714) + [445]=> + int(26220) + [446]=> + int(17235) + [447]=> + int(19777) + [448]=> + int(65535) + [449]=> + int(65535) + [450]=> + int(65535) + [451]=> + int(65535) + [452]=> + int(65535) + [453]=> + int(65535) + [454]=> + int(65535) + [455]=> + int(65535) + [456]=> + int(501) + [457]=> + int(0) + [458]=> + int(20) + [459]=> + int(0) + [460]=> + int(0) + [461]=> + int(0) + [462]=> + int(16877) + [463]=> + int(0) + [464]=> + int(3) + [465]=> + int(0) + [466]=> + int(0) + [467]=> + int(0) + [468]=> + int(0) + [469]=> + int(0) + [470]=> + int(0) + [471]=> + int(0) + [472]=> + int(65535) + [473]=> + int(65535) + [474]=> + int(65535) + [475]=> + int(65535) + [476]=> + int(65535) + [477]=> + int(65535) + [478]=> + int(65535) + [479]=> + int(65535) + [480]=> + int(0) + [481]=> + int(0) + [482]=> + int(54028) + [483]=> + int(2772) + [484]=> + int(16) + [485]=> + int(57377) + [486]=> + int(1024) + [487]=> + int(960) + [488]=> + int(0) + [489]=> + int(0) + [490]=> + int(42384) + [491]=> + int(8408) + [492]=> + int(65436) + [493]=> + int(0) + [494]=> + int(47655) + [495]=> + int(8) + [496]=> + int(1136) + [497]=> + int(8348) + [498]=> + int(0) + [499]=> + int(0) + [500]=> + int(0) + [501]=> + int(0) + [502]=> + int(0) + [503]=> + int(0) + [504]=> + int(0) + [505]=> + int(0) + [506]=> + int(0) + [507]=> + int(12326) + [508]=> + int(50261) + [509]=> + int(0) + [510]=> + int(0) + [511]=> + int(12326) + [512]=> + int(0) + [513]=> + int(65280) + [514]=> + int(32512) + [515]=> + int(49152) + [516]=> + int(0) + [517]=> + int(0) + [518]=> + int(22663) + [519]=> + int(2) + [520]=> + int(0) + [521]=> + int(0) + [522]=> + int(24576) + [523]=> + int(2) + [524]=> + int(0) + [525]=> + int(0) + [526]=> + int(501) + [527]=> + int(0) + [528]=> + int(20) + [529]=> + int(0) + [530]=> + int(0) + [531]=> + int(0) + [532]=> + int(33188) + [533]=> + int(0) + [534]=> + int(0) + [535]=> + int(0) + [536]=> + int(0) + [537]=> + int(0) + [538]=> + int(0) + [539]=> + int(0) + [540]=> + int(0) + [541]=> + int(0) + [542]=> + int(0) + [543]=> + int(0) + [544]=> + int(0) + [545]=> + int(0) + [546]=> + int(0) + [547]=> + int(0) + [548]=> + int(0) + [549]=> + int(0) + [550]=> + int(0) + [551]=> + int(0) + [552]=> + int(51766) + [553]=> + int(1946) + [554]=> + int(0) + [555]=> + int(24609) + [556]=> + int(1088) + [557]=> + int(960) + [558]=> + int(0) + [559]=> + int(0) + [560]=> + int(0) + [561]=> + int(0) + [562]=> + int(25116) + [563]=> + int(2012) + [564]=> + int(0) + [565]=> + int(0) + [566]=> + int(0) + [567]=> + int(0) + [568]=> + int(0) + [569]=> + int(0) + [570]=> + int(0) + [571]=> + int(0) + [572]=> + int(0) + [573]=> + int(0) + [574]=> + int(0) + [575]=> + int(0) + [576]=> + int(0) + [577]=> + int(0) + [578]=> + int(0) + [579]=> + int(0) + [580]=> + int(0) + [581]=> + int(0) + [582]=> + int(0) + [583]=> + int(0) + [584]=> + int(0) + [585]=> + int(0) + [586]=> + int(0) + [587]=> + int(0) + [588]=> + int(0) + [589]=> + int(0) + [590]=> + int(0) + [591]=> + int(0) + [592]=> + int(0) + [593]=> + int(0) + [594]=> + int(0) + [595]=> + int(0) + [596]=> + int(0) + [597]=> + int(0) + [598]=> + int(0) + [599]=> + int(0) + [600]=> + int(0) + [601]=> + int(0) + [602]=> + int(0) + [603]=> + int(0) + [604]=> + int(0) + [605]=> + int(0) + [606]=> + int(0) + [607]=> + int(0) + [608]=> + int(0) + [609]=> + int(0) + [610]=> + int(0) + [611]=> + int(0) + [612]=> + int(0) + [613]=> + int(0) + [614]=> + int(0) + [615]=> + int(0) + [616]=> + int(0) + [617]=> + int(0) + [618]=> + int(0) + [619]=> + int(0) + [620]=> + int(0) + [621]=> + int(0) + [622]=> + int(0) + [623]=> + int(0) + [624]=> + int(0) + [625]=> + int(0) + [626]=> + int(0) + [627]=> + int(0) + [628]=> + int(0) + [629]=> + int(0) + [630]=> + int(0) + [631]=> + int(0) + [632]=> + int(0) + [633]=> + int(0) + [634]=> + int(0) + [635]=> + int(0) + [636]=> + int(0) + [637]=> + int(0) + [638]=> + int(0) + [639]=> + int(0) + [640]=> + int(0) + [641]=> + int(0) + [642]=> + int(0) + [643]=> + int(0) + [644]=> + int(0) + [645]=> + int(0) + [646]=> + int(0) + [647]=> + int(0) + [648]=> + int(0) + [649]=> + int(0) + [650]=> + int(0) + [651]=> + int(0) + [652]=> + int(0) + [653]=> + int(0) + [654]=> + int(0) + [655]=> + int(0) + [656]=> + int(0) + [657]=> + int(0) + [658]=> + int(0) + [659]=> + int(0) + [660]=> + int(0) + [661]=> + int(0) + [662]=> + int(0) + [663]=> + int(0) + [664]=> + int(0) + [665]=> + int(0) + [666]=> + int(0) + [667]=> + int(0) + [668]=> + int(0) + [669]=> + int(0) + [670]=> + int(0) + [671]=> + int(0) + [672]=> + int(0) + [673]=> + int(0) + [674]=> + int(0) + [675]=> + int(0) + [676]=> + int(0) + [677]=> + int(0) + [678]=> + int(0) + [679]=> + int(0) + [680]=> + int(0) + [681]=> + int(0) + [682]=> + int(0) + [683]=> + int(0) + [684]=> + int(0) + [685]=> + int(0) + [686]=> + int(0) + [687]=> + int(0) + [688]=> + int(0) + [689]=> + int(0) + [690]=> + int(0) + [691]=> + int(0) + [692]=> + int(0) + [693]=> + int(0) + [694]=> + int(0) + [695]=> + int(0) + [696]=> + int(0) + [697]=> + int(0) + [698]=> + int(0) + [699]=> + int(0) + [700]=> + int(0) + [701]=> + int(0) + [702]=> + int(0) + [703]=> + int(0) + [704]=> + int(0) + [705]=> + int(0) + [706]=> + int(0) + [707]=> + int(0) + [708]=> + int(0) + [709]=> + int(0) + [710]=> + int(0) + [711]=> + int(0) + [712]=> + int(0) + [713]=> + int(0) + [714]=> + int(0) + [715]=> + int(0) + [716]=> + int(0) + [717]=> + int(0) + [718]=> + int(0) + [719]=> + int(0) + [720]=> + int(0) + [721]=> + int(0) + [722]=> + int(0) + [723]=> + int(0) + [724]=> + int(0) + [725]=> + int(0) + [726]=> + int(0) + [727]=> + int(0) + [728]=> + int(0) + [729]=> + int(0) + [730]=> + int(0) + [731]=> + int(0) + [732]=> + int(0) + [733]=> + int(0) + [734]=> + int(0) + [735]=> + int(0) + [736]=> + int(0) + [737]=> + int(0) + [738]=> + int(0) + [739]=> + int(0) + [740]=> + int(0) + [741]=> + int(0) + [742]=> + int(0) + [743]=> + int(0) + [744]=> + int(0) + [745]=> + int(0) + [746]=> + int(0) + [747]=> + int(0) + [748]=> + int(0) + [749]=> + int(0) + [750]=> + int(0) + [751]=> + int(0) + [752]=> + int(0) + [753]=> + int(0) + [754]=> + int(0) + [755]=> + int(0) + [756]=> + int(0) + [757]=> + int(0) + [758]=> + int(0) + [759]=> + int(0) + [760]=> + int(0) + [761]=> + int(0) + [762]=> + int(0) + [763]=> + int(0) + [764]=> + int(0) + [765]=> + int(0) + [766]=> + int(0) + [767]=> + int(0) + } + ["Copyright"]=> + string(12) "Eric Stewart" +} +--CREDIT-- +Eric Stewart <ericleestewart@gmail.com> diff --git a/ext/exif/tests/exif017.phpt b/ext/exif/tests/exif017.phpt new file mode 100644 index 0000000..36c3965 --- /dev/null +++ b/ext/exif/tests/exif017.phpt @@ -0,0 +1,1622 @@ +--TEST-- +Check for exif_read_data, TIFF with IFD data in Motorola byte-order. +--SKIPIF-- +<?php if (!extension_loaded('exif')) print 'skip exif extension not available';?> +--INI-- +output_handler= +zlib.output_compression=0 +--FILE-- +<?php +var_dump(exif_read_data(dirname(__FILE__).'/image017.tiff')); +?> +--EXPECTF-- +array(26) { + ["FileName"]=> + string(13) "image017.tiff" + ["FileDateTime"]=> + int(%d) + ["FileSize"]=> + int(%d) + ["FileType"]=> + int(8) + ["MimeType"]=> + string(10) "image/tiff" + ["SectionsFound"]=> + string(13) "ANY_TAG, IFD0" + ["COMPUTED"]=> + array(8) { + ["html"]=> + string(20) "width="1" height="1"" + ["Height"]=> + int(1) + ["Width"]=> + int(1) + ["IsColor"]=> + int(1) + ["ByteOrderMotorola"]=> + int(1) + ["Copyright"]=> + string(24) "Eric Stewart, Hex Editor" + ["Copyright.Photographer"]=> + string(12) "Eric Stewart" + ["Copyright.Editor"]=> + string(10) "Hex Editor" + } + ["ImageWidth"]=> + int(1) + ["ImageLength"]=> + int(1) + ["BitsPerSample"]=> + int(8) + ["Compression"]=> + int(5) + ["PhotometricInterpretation"]=> + int(3) + ["ImageDescription"]=> + string(15) "My description." + ["Make"]=> + string(11) "OpenShutter" + ["Model"]=> + string(8) "OS 1.0.0" + ["StripOffsets"]=> + int(1870) + ["SamplesPerPixel"]=> + int(1) + ["RowsPerStrip"]=> + int(8) + ["StripByteCounts"]=> + int(4) + ["XResolution"]=> + string(17) "381681664/2097152" + ["YResolution"]=> + string(17) "381681664/2097152" + ["PlanarConfiguration"]=> + int(1) + ["ResolutionUnit"]=> + int(2) + ["Artist"]=> + string(12) "Eric Stewart" + ["ColorMap"]=> + array(768) { + [0]=> + int(0) + [1]=> + int(65280) + [2]=> + int(32512) + [3]=> + int(49152) + [4]=> + int(99) + [5]=> + int(115) + [6]=> + int(116) + [7]=> + int(101) + [8]=> + int(119) + [9]=> + int(97) + [10]=> + int(114) + [11]=> + int(116) + [12]=> + int(0) + [13]=> + int(0) + [14]=> + int(0) + [15]=> + int(0) + [16]=> + int(0) + [17]=> + int(0) + [18]=> + int(0) + [19]=> + int(0) + [20]=> + int(0) + [21]=> + int(0) + [22]=> + int(0) + [23]=> + int(0) + [24]=> + int(0) + [25]=> + int(0) + [26]=> + int(0) + [27]=> + int(0) + [28]=> + int(0) + [29]=> + int(0) + [30]=> + int(0) + [31]=> + int(0) + [32]=> + int(0) + [33]=> + int(0) + [34]=> + int(0) + [35]=> + int(0) + [36]=> + int(0) + [37]=> + int(0) + [38]=> + int(0) + [39]=> + int(0) + [40]=> + int(0) + [41]=> + int(0) + [42]=> + int(0) + [43]=> + int(0) + [44]=> + int(0) + [45]=> + int(0) + [46]=> + int(0) + [47]=> + int(0) + [48]=> + int(0) + [49]=> + int(0) + [50]=> + int(0) + [51]=> + int(0) + [52]=> + int(0) + [53]=> + int(0) + [54]=> + int(0) + [55]=> + int(0) + [56]=> + int(0) + [57]=> + int(0) + [58]=> + int(0) + [59]=> + int(0) + [60]=> + int(0) + [61]=> + int(0) + [62]=> + int(0) + [63]=> + int(0) + [64]=> + int(0) + [65]=> + int(0) + [66]=> + int(0) + [67]=> + int(0) + [68]=> + int(0) + [69]=> + int(0) + [70]=> + int(0) + [71]=> + int(0) + [72]=> + int(0) + [73]=> + int(0) + [74]=> + int(0) + [75]=> + int(0) + [76]=> + int(0) + [77]=> + int(0) + [78]=> + int(0) + [79]=> + int(0) + [80]=> + int(0) + [81]=> + int(0) + [82]=> + int(0) + [83]=> + int(0) + [84]=> + int(0) + [85]=> + int(0) + [86]=> + int(0) + [87]=> + int(0) + [88]=> + int(0) + [89]=> + int(0) + [90]=> + int(0) + [91]=> + int(0) + [92]=> + int(0) + [93]=> + int(0) + [94]=> + int(0) + [95]=> + int(0) + [96]=> + int(0) + [97]=> + int(0) + [98]=> + int(0) + [99]=> + int(0) + [100]=> + int(0) + [101]=> + int(0) + [102]=> + int(0) + [103]=> + int(0) + [104]=> + int(0) + [105]=> + int(0) + [106]=> + int(0) + [107]=> + int(0) + [108]=> + int(0) + [109]=> + int(0) + [110]=> + int(0) + [111]=> + int(0) + [112]=> + int(0) + [113]=> + int(0) + [114]=> + int(0) + [115]=> + int(0) + [116]=> + int(0) + [117]=> + int(0) + [118]=> + int(0) + [119]=> + int(0) + [120]=> + int(0) + [121]=> + int(0) + [122]=> + int(0) + [123]=> + int(0) + [124]=> + int(0) + [125]=> + int(0) + [126]=> + int(0) + [127]=> + int(0) + [128]=> + int(0) + [129]=> + int(0) + [130]=> + int(0) + [131]=> + int(0) + [132]=> + int(0) + [133]=> + int(0) + [134]=> + int(0) + [135]=> + int(0) + [136]=> + int(0) + [137]=> + int(0) + [138]=> + int(0) + [139]=> + int(0) + [140]=> + int(0) + [141]=> + int(0) + [142]=> + int(0) + [143]=> + int(0) + [144]=> + int(0) + [145]=> + int(0) + [146]=> + int(0) + [147]=> + int(0) + [148]=> + int(0) + [149]=> + int(0) + [150]=> + int(0) + [151]=> + int(0) + [152]=> + int(0) + [153]=> + int(0) + [154]=> + int(0) + [155]=> + int(0) + [156]=> + int(0) + [157]=> + int(0) + [158]=> + int(0) + [159]=> + int(0) + [160]=> + int(0) + [161]=> + int(0) + [162]=> + int(0) + [163]=> + int(0) + [164]=> + int(0) + [165]=> + int(0) + [166]=> + int(0) + [167]=> + int(0) + [168]=> + int(0) + [169]=> + int(0) + [170]=> + int(0) + [171]=> + int(0) + [172]=> + int(0) + [173]=> + int(0) + [174]=> + int(0) + [175]=> + int(0) + [176]=> + int(0) + [177]=> + int(0) + [178]=> + int(0) + [179]=> + int(0) + [180]=> + int(0) + [181]=> + int(0) + [182]=> + int(0) + [183]=> + int(0) + [184]=> + int(0) + [185]=> + int(0) + [186]=> + int(0) + [187]=> + int(0) + [188]=> + int(0) + [189]=> + int(0) + [190]=> + int(0) + [191]=> + int(0) + [192]=> + int(0) + [193]=> + int(0) + [194]=> + int(0) + [195]=> + int(0) + [196]=> + int(0) + [197]=> + int(0) + [198]=> + int(0) + [199]=> + int(0) + [200]=> + int(0) + [201]=> + int(0) + [202]=> + int(0) + [203]=> + int(0) + [204]=> + int(0) + [205]=> + int(0) + [206]=> + int(0) + [207]=> + int(0) + [208]=> + int(0) + [209]=> + int(0) + [210]=> + int(0) + [211]=> + int(0) + [212]=> + int(0) + [213]=> + int(0) + [214]=> + int(0) + [215]=> + int(0) + [216]=> + int(0) + [217]=> + int(0) + [218]=> + int(0) + [219]=> + int(0) + [220]=> + int(0) + [221]=> + int(0) + [222]=> + int(0) + [223]=> + int(0) + [224]=> + int(0) + [225]=> + int(0) + [226]=> + int(0) + [227]=> + int(0) + [228]=> + int(0) + [229]=> + int(0) + [230]=> + int(0) + [231]=> + int(0) + [232]=> + int(0) + [233]=> + int(0) + [234]=> + int(0) + [235]=> + int(0) + [236]=> + int(0) + [237]=> + int(0) + [238]=> + int(0) + [239]=> + int(0) + [240]=> + int(0) + [241]=> + int(0) + [242]=> + int(0) + [243]=> + int(0) + [244]=> + int(0) + [245]=> + int(0) + [246]=> + int(0) + [247]=> + int(0) + [248]=> + int(0) + [249]=> + int(0) + [250]=> + int(0) + [251]=> + int(0) + [252]=> + int(0) + [253]=> + int(0) + [254]=> + int(0) + [255]=> + int(1) + [256]=> + int(0) + [257]=> + int(65280) + [258]=> + int(32512) + [259]=> + int(49152) + [260]=> + int(0) + [261]=> + int(0) + [262]=> + int(0) + [263]=> + int(0) + [264]=> + int(0) + [265]=> + int(0) + [266]=> + int(0) + [267]=> + int(0) + [268]=> + int(0) + [269]=> + int(0) + [270]=> + int(0) + [271]=> + int(0) + [272]=> + int(11945) + [273]=> + int(1914) + [274]=> + int(0) + [275]=> + int(24609) + [276]=> + int(1088) + [277]=> + int(960) + [278]=> + int(0) + [279]=> + int(0) + [280]=> + int(20000) + [281]=> + int(8414) + [282]=> + int(65436) + [283]=> + int(0) + [284]=> + int(47655) + [285]=> + int(8) + [286]=> + int(37936) + [287]=> + int(8406) + [288]=> + int(0) + [289]=> + int(0) + [290]=> + int(0) + [291]=> + int(0) + [292]=> + int(0) + [293]=> + int(0) + [294]=> + int(0) + [295]=> + int(0) + [296]=> + int(0) + [297]=> + int(64652) + [298]=> + int(50264) + [299]=> + int(0) + [300]=> + int(0) + [301]=> + int(64887) + [302]=> + int(50264) + [303]=> + int(0) + [304]=> + int(25714) + [305]=> + int(26220) + [306]=> + int(17235) + [307]=> + int(19777) + [308]=> + int(65535) + [309]=> + int(65535) + [310]=> + int(65535) + [311]=> + int(65535) + [312]=> + int(65535) + [313]=> + int(65535) + [314]=> + int(65535) + [315]=> + int(65535) + [316]=> + int(501) + [317]=> + int(0) + [318]=> + int(20) + [319]=> + int(0) + [320]=> + int(0) + [321]=> + int(0) + [322]=> + int(16877) + [323]=> + int(0) + [324]=> + int(3) + [325]=> + int(0) + [326]=> + int(0) + [327]=> + int(0) + [328]=> + int(0) + [329]=> + int(0) + [330]=> + int(0) + [331]=> + int(0) + [332]=> + int(65535) + [333]=> + int(65535) + [334]=> + int(65535) + [335]=> + int(65535) + [336]=> + int(65535) + [337]=> + int(65535) + [338]=> + int(65535) + [339]=> + int(65535) + [340]=> + int(0) + [341]=> + int(0) + [342]=> + int(52840) + [343]=> + int(2025) + [344]=> + int(16) + [345]=> + int(57377) + [346]=> + int(1024) + [347]=> + int(960) + [348]=> + int(0) + [349]=> + int(0) + [350]=> + int(27136) + [351]=> + int(8414) + [352]=> + int(65436) + [353]=> + int(0) + [354]=> + int(47655) + [355]=> + int(8) + [356]=> + int(62400) + [357]=> + int(8407) + [358]=> + int(0) + [359]=> + int(0) + [360]=> + int(0) + [361]=> + int(0) + [362]=> + int(0) + [363]=> + int(0) + [364]=> + int(0) + [365]=> + int(0) + [366]=> + int(0) + [367]=> + int(64857) + [368]=> + int(50264) + [369]=> + int(0) + [370]=> + int(0) + [371]=> + int(64892) + [372]=> + int(50264) + [373]=> + int(0) + [374]=> + int(25714) + [375]=> + int(26220) + [376]=> + int(17235) + [377]=> + int(19777) + [378]=> + int(65535) + [379]=> + int(65535) + [380]=> + int(65535) + [381]=> + int(65535) + [382]=> + int(65535) + [383]=> + int(65535) + [384]=> + int(65535) + [385]=> + int(65535) + [386]=> + int(501) + [387]=> + int(0) + [388]=> + int(20) + [389]=> + int(0) + [390]=> + int(0) + [391]=> + int(0) + [392]=> + int(16877) + [393]=> + int(0) + [394]=> + int(3) + [395]=> + int(0) + [396]=> + int(0) + [397]=> + int(0) + [398]=> + int(0) + [399]=> + int(0) + [400]=> + int(0) + [401]=> + int(0) + [402]=> + int(65535) + [403]=> + int(65535) + [404]=> + int(65535) + [405]=> + int(65535) + [406]=> + int(65535) + [407]=> + int(65535) + [408]=> + int(65535) + [409]=> + int(65535) + [410]=> + int(0) + [411]=> + int(0) + [412]=> + int(53440) + [413]=> + int(2025) + [414]=> + int(16) + [415]=> + int(57377) + [416]=> + int(1024) + [417]=> + int(960) + [418]=> + int(0) + [419]=> + int(0) + [420]=> + int(41120) + [421]=> + int(9024) + [422]=> + int(65436) + [423]=> + int(0) + [424]=> + int(47655) + [425]=> + int(8) + [426]=> + int(24480) + [427]=> + int(8404) + [428]=> + int(0) + [429]=> + int(0) + [430]=> + int(0) + [431]=> + int(0) + [432]=> + int(0) + [433]=> + int(0) + [434]=> + int(0) + [435]=> + int(0) + [436]=> + int(0) + [437]=> + int(21315) + [438]=> + int(50294) + [439]=> + int(0) + [440]=> + int(0) + [441]=> + int(53635) + [442]=> + int(50294) + [443]=> + int(0) + [444]=> + int(25714) + [445]=> + int(26220) + [446]=> + int(17235) + [447]=> + int(19777) + [448]=> + int(65535) + [449]=> + int(65535) + [450]=> + int(65535) + [451]=> + int(65535) + [452]=> + int(65535) + [453]=> + int(65535) + [454]=> + int(65535) + [455]=> + int(65535) + [456]=> + int(501) + [457]=> + int(0) + [458]=> + int(20) + [459]=> + int(0) + [460]=> + int(0) + [461]=> + int(0) + [462]=> + int(16877) + [463]=> + int(0) + [464]=> + int(3) + [465]=> + int(0) + [466]=> + int(0) + [467]=> + int(0) + [468]=> + int(0) + [469]=> + int(0) + [470]=> + int(0) + [471]=> + int(0) + [472]=> + int(65535) + [473]=> + int(65535) + [474]=> + int(65535) + [475]=> + int(65535) + [476]=> + int(65535) + [477]=> + int(65535) + [478]=> + int(65535) + [479]=> + int(65535) + [480]=> + int(0) + [481]=> + int(0) + [482]=> + int(54028) + [483]=> + int(2772) + [484]=> + int(16) + [485]=> + int(57377) + [486]=> + int(1024) + [487]=> + int(960) + [488]=> + int(0) + [489]=> + int(0) + [490]=> + int(42384) + [491]=> + int(8408) + [492]=> + int(65436) + [493]=> + int(0) + [494]=> + int(47655) + [495]=> + int(8) + [496]=> + int(1136) + [497]=> + int(8348) + [498]=> + int(0) + [499]=> + int(0) + [500]=> + int(0) + [501]=> + int(0) + [502]=> + int(0) + [503]=> + int(0) + [504]=> + int(0) + [505]=> + int(0) + [506]=> + int(0) + [507]=> + int(12326) + [508]=> + int(50261) + [509]=> + int(0) + [510]=> + int(0) + [511]=> + int(12326) + [512]=> + int(0) + [513]=> + int(65280) + [514]=> + int(32512) + [515]=> + int(49152) + [516]=> + int(0) + [517]=> + int(0) + [518]=> + int(22663) + [519]=> + int(2) + [520]=> + int(0) + [521]=> + int(0) + [522]=> + int(24576) + [523]=> + int(2) + [524]=> + int(0) + [525]=> + int(0) + [526]=> + int(501) + [527]=> + int(0) + [528]=> + int(20) + [529]=> + int(0) + [530]=> + int(0) + [531]=> + int(0) + [532]=> + int(33188) + [533]=> + int(0) + [534]=> + int(0) + [535]=> + int(0) + [536]=> + int(0) + [537]=> + int(0) + [538]=> + int(0) + [539]=> + int(0) + [540]=> + int(0) + [541]=> + int(0) + [542]=> + int(0) + [543]=> + int(0) + [544]=> + int(0) + [545]=> + int(0) + [546]=> + int(0) + [547]=> + int(0) + [548]=> + int(0) + [549]=> + int(0) + [550]=> + int(0) + [551]=> + int(0) + [552]=> + int(51766) + [553]=> + int(1946) + [554]=> + int(0) + [555]=> + int(24609) + [556]=> + int(1088) + [557]=> + int(960) + [558]=> + int(0) + [559]=> + int(0) + [560]=> + int(0) + [561]=> + int(0) + [562]=> + int(25116) + [563]=> + int(2012) + [564]=> + int(0) + [565]=> + int(0) + [566]=> + int(0) + [567]=> + int(0) + [568]=> + int(0) + [569]=> + int(0) + [570]=> + int(0) + [571]=> + int(0) + [572]=> + int(0) + [573]=> + int(0) + [574]=> + int(0) + [575]=> + int(0) + [576]=> + int(0) + [577]=> + int(0) + [578]=> + int(0) + [579]=> + int(0) + [580]=> + int(0) + [581]=> + int(0) + [582]=> + int(0) + [583]=> + int(0) + [584]=> + int(0) + [585]=> + int(0) + [586]=> + int(0) + [587]=> + int(0) + [588]=> + int(0) + [589]=> + int(0) + [590]=> + int(0) + [591]=> + int(0) + [592]=> + int(0) + [593]=> + int(0) + [594]=> + int(0) + [595]=> + int(0) + [596]=> + int(0) + [597]=> + int(0) + [598]=> + int(0) + [599]=> + int(0) + [600]=> + int(0) + [601]=> + int(0) + [602]=> + int(0) + [603]=> + int(0) + [604]=> + int(0) + [605]=> + int(0) + [606]=> + int(0) + [607]=> + int(0) + [608]=> + int(0) + [609]=> + int(0) + [610]=> + int(0) + [611]=> + int(0) + [612]=> + int(0) + [613]=> + int(0) + [614]=> + int(0) + [615]=> + int(0) + [616]=> + int(0) + [617]=> + int(0) + [618]=> + int(0) + [619]=> + int(0) + [620]=> + int(0) + [621]=> + int(0) + [622]=> + int(0) + [623]=> + int(0) + [624]=> + int(0) + [625]=> + int(0) + [626]=> + int(0) + [627]=> + int(0) + [628]=> + int(0) + [629]=> + int(0) + [630]=> + int(0) + [631]=> + int(0) + [632]=> + int(0) + [633]=> + int(0) + [634]=> + int(0) + [635]=> + int(0) + [636]=> + int(0) + [637]=> + int(0) + [638]=> + int(0) + [639]=> + int(0) + [640]=> + int(0) + [641]=> + int(0) + [642]=> + int(0) + [643]=> + int(0) + [644]=> + int(0) + [645]=> + int(0) + [646]=> + int(0) + [647]=> + int(0) + [648]=> + int(0) + [649]=> + int(0) + [650]=> + int(0) + [651]=> + int(0) + [652]=> + int(0) + [653]=> + int(0) + [654]=> + int(0) + [655]=> + int(0) + [656]=> + int(0) + [657]=> + int(0) + [658]=> + int(0) + [659]=> + int(0) + [660]=> + int(0) + [661]=> + int(0) + [662]=> + int(0) + [663]=> + int(0) + [664]=> + int(0) + [665]=> + int(0) + [666]=> + int(0) + [667]=> + int(0) + [668]=> + int(0) + [669]=> + int(0) + [670]=> + int(0) + [671]=> + int(0) + [672]=> + int(0) + [673]=> + int(0) + [674]=> + int(0) + [675]=> + int(0) + [676]=> + int(0) + [677]=> + int(0) + [678]=> + int(0) + [679]=> + int(0) + [680]=> + int(0) + [681]=> + int(0) + [682]=> + int(0) + [683]=> + int(0) + [684]=> + int(0) + [685]=> + int(0) + [686]=> + int(0) + [687]=> + int(0) + [688]=> + int(0) + [689]=> + int(0) + [690]=> + int(0) + [691]=> + int(0) + [692]=> + int(0) + [693]=> + int(0) + [694]=> + int(0) + [695]=> + int(0) + [696]=> + int(0) + [697]=> + int(0) + [698]=> + int(0) + [699]=> + int(0) + [700]=> + int(0) + [701]=> + int(0) + [702]=> + int(0) + [703]=> + int(0) + [704]=> + int(0) + [705]=> + int(0) + [706]=> + int(0) + [707]=> + int(0) + [708]=> + int(0) + [709]=> + int(0) + [710]=> + int(0) + [711]=> + int(0) + [712]=> + int(0) + [713]=> + int(0) + [714]=> + int(0) + [715]=> + int(0) + [716]=> + int(0) + [717]=> + int(0) + [718]=> + int(0) + [719]=> + int(0) + [720]=> + int(0) + [721]=> + int(0) + [722]=> + int(0) + [723]=> + int(0) + [724]=> + int(0) + [725]=> + int(0) + [726]=> + int(0) + [727]=> + int(0) + [728]=> + int(0) + [729]=> + int(0) + [730]=> + int(0) + [731]=> + int(0) + [732]=> + int(0) + [733]=> + int(0) + [734]=> + int(0) + [735]=> + int(0) + [736]=> + int(0) + [737]=> + int(0) + [738]=> + int(0) + [739]=> + int(0) + [740]=> + int(0) + [741]=> + int(0) + [742]=> + int(0) + [743]=> + int(0) + [744]=> + int(0) + [745]=> + int(0) + [746]=> + int(0) + [747]=> + int(0) + [748]=> + int(0) + [749]=> + int(0) + [750]=> + int(0) + [751]=> + int(0) + [752]=> + int(0) + [753]=> + int(0) + [754]=> + int(0) + [755]=> + int(0) + [756]=> + int(0) + [757]=> + int(0) + [758]=> + int(0) + [759]=> + int(0) + [760]=> + int(0) + [761]=> + int(0) + [762]=> + int(0) + [763]=> + int(0) + [764]=> + int(0) + [765]=> + int(0) + [766]=> + int(0) + [767]=> + int(0) + } + ["Copyright"]=> + string(12) "Eric Stewart" +} +--CREDIT-- +Eric Stewart <ericleestewart@gmail.com> diff --git a/ext/exif/tests/exif018.phpt b/ext/exif/tests/exif018.phpt new file mode 100644 index 0000000..a4ca53c --- /dev/null +++ b/ext/exif/tests/exif018.phpt @@ -0,0 +1,1646 @@ +--TEST-- +Check for exif_read_data, TIFF with IFD and EXIF data in Intel byte-order. +--SKIPIF-- +<?php if (!extension_loaded('exif')) print 'skip exif extension not available';?> +--INI-- +output_handler= +zlib.output_compression=0 +--FILE-- +<?php +var_dump(exif_read_data(dirname(__FILE__).'/image018.tiff')); +?> +--EXPECTF-- +array(37) { + ["FileName"]=> + string(13) "image018.tiff" + ["FileDateTime"]=> + int(%d) + ["FileSize"]=> + int(%d) + ["FileType"]=> + int(7) + ["MimeType"]=> + string(10) "image/tiff" + ["SectionsFound"]=> + string(19) "ANY_TAG, IFD0, EXIF" + ["COMPUTED"]=> + array(9) { + ["html"]=> + string(20) "width="1" height="1"" + ["Height"]=> + int(1) + ["Width"]=> + int(1) + ["IsColor"]=> + int(1) + ["ByteOrderMotorola"]=> + int(0) + ["ApertureFNumber"]=> + string(5) "f/8.0" + ["Copyright"]=> + string(24) "Eric Stewart, Hex Editor" + ["Copyright.Photographer"]=> + string(12) "Eric Stewart" + ["Copyright.Editor"]=> + string(10) "Hex Editor" + } + ["ImageWidth"]=> + int(1) + ["ImageLength"]=> + int(1) + ["BitsPerSample"]=> + int(8) + ["Compression"]=> + int(5) + ["PhotometricInterpretation"]=> + int(3) + ["ImageDescription"]=> + string(15) "My description." + ["Make"]=> + string(11) "OpenShutter" + ["Model"]=> + string(8) "OS 1.0.0" + ["StripOffsets"]=> + int(2084) + ["SamplesPerPixel"]=> + int(1) + ["RowsPerStrip"]=> + int(8) + ["StripByteCounts"]=> + int(4) + ["XResolution"]=> + string(17) "381681664/2097152" + ["YResolution"]=> + string(17) "381681664/2097152" + ["PlanarConfiguration"]=> + int(1) + ["ResolutionUnit"]=> + int(2) + ["Artist"]=> + string(12) "Eric Stewart" + ["ColorMap"]=> + array(768) { + [0]=> + int(0) + [1]=> + int(65280) + [2]=> + int(32512) + [3]=> + int(49152) + [4]=> + int(99) + [5]=> + int(115) + [6]=> + int(116) + [7]=> + int(101) + [8]=> + int(119) + [9]=> + int(97) + [10]=> + int(114) + [11]=> + int(116) + [12]=> + int(0) + [13]=> + int(0) + [14]=> + int(0) + [15]=> + int(0) + [16]=> + int(0) + [17]=> + int(0) + [18]=> + int(0) + [19]=> + int(0) + [20]=> + int(0) + [21]=> + int(0) + [22]=> + int(0) + [23]=> + int(0) + [24]=> + int(0) + [25]=> + int(0) + [26]=> + int(0) + [27]=> + int(0) + [28]=> + int(0) + [29]=> + int(0) + [30]=> + int(0) + [31]=> + int(0) + [32]=> + int(0) + [33]=> + int(0) + [34]=> + int(0) + [35]=> + int(0) + [36]=> + int(0) + [37]=> + int(0) + [38]=> + int(0) + [39]=> + int(0) + [40]=> + int(0) + [41]=> + int(0) + [42]=> + int(0) + [43]=> + int(0) + [44]=> + int(0) + [45]=> + int(0) + [46]=> + int(0) + [47]=> + int(0) + [48]=> + int(0) + [49]=> + int(0) + [50]=> + int(0) + [51]=> + int(0) + [52]=> + int(0) + [53]=> + int(0) + [54]=> + int(0) + [55]=> + int(0) + [56]=> + int(0) + [57]=> + int(0) + [58]=> + int(0) + [59]=> + int(0) + [60]=> + int(0) + [61]=> + int(0) + [62]=> + int(0) + [63]=> + int(0) + [64]=> + int(0) + [65]=> + int(0) + [66]=> + int(0) + [67]=> + int(0) + [68]=> + int(0) + [69]=> + int(0) + [70]=> + int(0) + [71]=> + int(0) + [72]=> + int(0) + [73]=> + int(0) + [74]=> + int(0) + [75]=> + int(0) + [76]=> + int(0) + [77]=> + int(0) + [78]=> + int(0) + [79]=> + int(0) + [80]=> + int(0) + [81]=> + int(0) + [82]=> + int(0) + [83]=> + int(0) + [84]=> + int(0) + [85]=> + int(0) + [86]=> + int(0) + [87]=> + int(0) + [88]=> + int(0) + [89]=> + int(0) + [90]=> + int(0) + [91]=> + int(0) + [92]=> + int(0) + [93]=> + int(0) + [94]=> + int(0) + [95]=> + int(0) + [96]=> + int(0) + [97]=> + int(0) + [98]=> + int(0) + [99]=> + int(0) + [100]=> + int(0) + [101]=> + int(0) + [102]=> + int(0) + [103]=> + int(0) + [104]=> + int(0) + [105]=> + int(0) + [106]=> + int(0) + [107]=> + int(0) + [108]=> + int(0) + [109]=> + int(0) + [110]=> + int(0) + [111]=> + int(0) + [112]=> + int(0) + [113]=> + int(0) + [114]=> + int(0) + [115]=> + int(0) + [116]=> + int(0) + [117]=> + int(0) + [118]=> + int(0) + [119]=> + int(0) + [120]=> + int(0) + [121]=> + int(0) + [122]=> + int(0) + [123]=> + int(0) + [124]=> + int(0) + [125]=> + int(0) + [126]=> + int(0) + [127]=> + int(0) + [128]=> + int(0) + [129]=> + int(0) + [130]=> + int(0) + [131]=> + int(0) + [132]=> + int(0) + [133]=> + int(0) + [134]=> + int(0) + [135]=> + int(0) + [136]=> + int(0) + [137]=> + int(0) + [138]=> + int(0) + [139]=> + int(0) + [140]=> + int(0) + [141]=> + int(0) + [142]=> + int(0) + [143]=> + int(0) + [144]=> + int(0) + [145]=> + int(0) + [146]=> + int(0) + [147]=> + int(0) + [148]=> + int(0) + [149]=> + int(0) + [150]=> + int(0) + [151]=> + int(0) + [152]=> + int(0) + [153]=> + int(0) + [154]=> + int(0) + [155]=> + int(0) + [156]=> + int(0) + [157]=> + int(0) + [158]=> + int(0) + [159]=> + int(0) + [160]=> + int(0) + [161]=> + int(0) + [162]=> + int(0) + [163]=> + int(0) + [164]=> + int(0) + [165]=> + int(0) + [166]=> + int(0) + [167]=> + int(0) + [168]=> + int(0) + [169]=> + int(0) + [170]=> + int(0) + [171]=> + int(0) + [172]=> + int(0) + [173]=> + int(0) + [174]=> + int(0) + [175]=> + int(0) + [176]=> + int(0) + [177]=> + int(0) + [178]=> + int(0) + [179]=> + int(0) + [180]=> + int(0) + [181]=> + int(0) + [182]=> + int(0) + [183]=> + int(0) + [184]=> + int(0) + [185]=> + int(0) + [186]=> + int(0) + [187]=> + int(0) + [188]=> + int(0) + [189]=> + int(0) + [190]=> + int(0) + [191]=> + int(0) + [192]=> + int(0) + [193]=> + int(0) + [194]=> + int(0) + [195]=> + int(0) + [196]=> + int(0) + [197]=> + int(0) + [198]=> + int(0) + [199]=> + int(0) + [200]=> + int(0) + [201]=> + int(0) + [202]=> + int(0) + [203]=> + int(0) + [204]=> + int(0) + [205]=> + int(0) + [206]=> + int(0) + [207]=> + int(0) + [208]=> + int(0) + [209]=> + int(0) + [210]=> + int(0) + [211]=> + int(0) + [212]=> + int(0) + [213]=> + int(0) + [214]=> + int(0) + [215]=> + int(0) + [216]=> + int(0) + [217]=> + int(0) + [218]=> + int(0) + [219]=> + int(0) + [220]=> + int(0) + [221]=> + int(0) + [222]=> + int(0) + [223]=> + int(0) + [224]=> + int(0) + [225]=> + int(0) + [226]=> + int(0) + [227]=> + int(0) + [228]=> + int(0) + [229]=> + int(0) + [230]=> + int(0) + [231]=> + int(0) + [232]=> + int(0) + [233]=> + int(0) + [234]=> + int(0) + [235]=> + int(0) + [236]=> + int(0) + [237]=> + int(0) + [238]=> + int(0) + [239]=> + int(0) + [240]=> + int(0) + [241]=> + int(0) + [242]=> + int(0) + [243]=> + int(0) + [244]=> + int(0) + [245]=> + int(0) + [246]=> + int(0) + [247]=> + int(0) + [248]=> + int(0) + [249]=> + int(0) + [250]=> + int(0) + [251]=> + int(0) + [252]=> + int(0) + [253]=> + int(0) + [254]=> + int(0) + [255]=> + int(1) + [256]=> + int(0) + [257]=> + int(65280) + [258]=> + int(32512) + [259]=> + int(49152) + [260]=> + int(0) + [261]=> + int(0) + [262]=> + int(0) + [263]=> + int(0) + [264]=> + int(0) + [265]=> + int(0) + [266]=> + int(0) + [267]=> + int(0) + [268]=> + int(0) + [269]=> + int(0) + [270]=> + int(0) + [271]=> + int(0) + [272]=> + int(11945) + [273]=> + int(1914) + [274]=> + int(0) + [275]=> + int(24609) + [276]=> + int(1088) + [277]=> + int(960) + [278]=> + int(0) + [279]=> + int(0) + [280]=> + int(20000) + [281]=> + int(8414) + [282]=> + int(65436) + [283]=> + int(0) + [284]=> + int(47655) + [285]=> + int(8) + [286]=> + int(37936) + [287]=> + int(8406) + [288]=> + int(0) + [289]=> + int(0) + [290]=> + int(0) + [291]=> + int(0) + [292]=> + int(0) + [293]=> + int(0) + [294]=> + int(0) + [295]=> + int(0) + [296]=> + int(0) + [297]=> + int(64652) + [298]=> + int(50264) + [299]=> + int(0) + [300]=> + int(0) + [301]=> + int(64887) + [302]=> + int(50264) + [303]=> + int(0) + [304]=> + int(25714) + [305]=> + int(26220) + [306]=> + int(17235) + [307]=> + int(19777) + [308]=> + int(65535) + [309]=> + int(65535) + [310]=> + int(65535) + [311]=> + int(65535) + [312]=> + int(65535) + [313]=> + int(65535) + [314]=> + int(65535) + [315]=> + int(65535) + [316]=> + int(501) + [317]=> + int(0) + [318]=> + int(20) + [319]=> + int(0) + [320]=> + int(0) + [321]=> + int(0) + [322]=> + int(16877) + [323]=> + int(0) + [324]=> + int(3) + [325]=> + int(0) + [326]=> + int(0) + [327]=> + int(0) + [328]=> + int(0) + [329]=> + int(0) + [330]=> + int(0) + [331]=> + int(0) + [332]=> + int(65535) + [333]=> + int(65535) + [334]=> + int(65535) + [335]=> + int(65535) + [336]=> + int(65535) + [337]=> + int(65535) + [338]=> + int(65535) + [339]=> + int(65535) + [340]=> + int(0) + [341]=> + int(0) + [342]=> + int(52840) + [343]=> + int(2025) + [344]=> + int(16) + [345]=> + int(57377) + [346]=> + int(1024) + [347]=> + int(960) + [348]=> + int(0) + [349]=> + int(0) + [350]=> + int(27136) + [351]=> + int(8414) + [352]=> + int(65436) + [353]=> + int(0) + [354]=> + int(47655) + [355]=> + int(8) + [356]=> + int(62400) + [357]=> + int(8407) + [358]=> + int(0) + [359]=> + int(0) + [360]=> + int(0) + [361]=> + int(0) + [362]=> + int(0) + [363]=> + int(0) + [364]=> + int(0) + [365]=> + int(0) + [366]=> + int(0) + [367]=> + int(64857) + [368]=> + int(50264) + [369]=> + int(0) + [370]=> + int(0) + [371]=> + int(64892) + [372]=> + int(50264) + [373]=> + int(0) + [374]=> + int(25714) + [375]=> + int(26220) + [376]=> + int(17235) + [377]=> + int(19777) + [378]=> + int(65535) + [379]=> + int(65535) + [380]=> + int(65535) + [381]=> + int(65535) + [382]=> + int(65535) + [383]=> + int(65535) + [384]=> + int(65535) + [385]=> + int(65535) + [386]=> + int(501) + [387]=> + int(0) + [388]=> + int(20) + [389]=> + int(0) + [390]=> + int(0) + [391]=> + int(0) + [392]=> + int(16877) + [393]=> + int(0) + [394]=> + int(3) + [395]=> + int(0) + [396]=> + int(0) + [397]=> + int(0) + [398]=> + int(0) + [399]=> + int(0) + [400]=> + int(0) + [401]=> + int(0) + [402]=> + int(65535) + [403]=> + int(65535) + [404]=> + int(65535) + [405]=> + int(65535) + [406]=> + int(65535) + [407]=> + int(65535) + [408]=> + int(65535) + [409]=> + int(65535) + [410]=> + int(0) + [411]=> + int(0) + [412]=> + int(53440) + [413]=> + int(2025) + [414]=> + int(16) + [415]=> + int(57377) + [416]=> + int(1024) + [417]=> + int(960) + [418]=> + int(0) + [419]=> + int(0) + [420]=> + int(41120) + [421]=> + int(9024) + [422]=> + int(65436) + [423]=> + int(0) + [424]=> + int(47655) + [425]=> + int(8) + [426]=> + int(24480) + [427]=> + int(8404) + [428]=> + int(0) + [429]=> + int(0) + [430]=> + int(0) + [431]=> + int(0) + [432]=> + int(0) + [433]=> + int(0) + [434]=> + int(0) + [435]=> + int(0) + [436]=> + int(0) + [437]=> + int(21315) + [438]=> + int(50294) + [439]=> + int(0) + [440]=> + int(0) + [441]=> + int(53635) + [442]=> + int(50294) + [443]=> + int(0) + [444]=> + int(25714) + [445]=> + int(26220) + [446]=> + int(17235) + [447]=> + int(19777) + [448]=> + int(65535) + [449]=> + int(65535) + [450]=> + int(65535) + [451]=> + int(65535) + [452]=> + int(65535) + [453]=> + int(65535) + [454]=> + int(65535) + [455]=> + int(65535) + [456]=> + int(501) + [457]=> + int(0) + [458]=> + int(20) + [459]=> + int(0) + [460]=> + int(0) + [461]=> + int(0) + [462]=> + int(16877) + [463]=> + int(0) + [464]=> + int(3) + [465]=> + int(0) + [466]=> + int(0) + [467]=> + int(0) + [468]=> + int(0) + [469]=> + int(0) + [470]=> + int(0) + [471]=> + int(0) + [472]=> + int(65535) + [473]=> + int(65535) + [474]=> + int(65535) + [475]=> + int(65535) + [476]=> + int(65535) + [477]=> + int(65535) + [478]=> + int(65535) + [479]=> + int(65535) + [480]=> + int(0) + [481]=> + int(0) + [482]=> + int(54028) + [483]=> + int(2772) + [484]=> + int(16) + [485]=> + int(57377) + [486]=> + int(1024) + [487]=> + int(960) + [488]=> + int(0) + [489]=> + int(0) + [490]=> + int(42384) + [491]=> + int(8408) + [492]=> + int(65436) + [493]=> + int(0) + [494]=> + int(47655) + [495]=> + int(8) + [496]=> + int(1136) + [497]=> + int(8348) + [498]=> + int(0) + [499]=> + int(0) + [500]=> + int(0) + [501]=> + int(0) + [502]=> + int(0) + [503]=> + int(0) + [504]=> + int(0) + [505]=> + int(0) + [506]=> + int(0) + [507]=> + int(12326) + [508]=> + int(50261) + [509]=> + int(0) + [510]=> + int(0) + [511]=> + int(12326) + [512]=> + int(0) + [513]=> + int(65280) + [514]=> + int(32512) + [515]=> + int(49152) + [516]=> + int(0) + [517]=> + int(0) + [518]=> + int(22663) + [519]=> + int(2) + [520]=> + int(0) + [521]=> + int(0) + [522]=> + int(24576) + [523]=> + int(2) + [524]=> + int(0) + [525]=> + int(0) + [526]=> + int(501) + [527]=> + int(0) + [528]=> + int(20) + [529]=> + int(0) + [530]=> + int(0) + [531]=> + int(0) + [532]=> + int(33188) + [533]=> + int(0) + [534]=> + int(0) + [535]=> + int(0) + [536]=> + int(0) + [537]=> + int(0) + [538]=> + int(0) + [539]=> + int(0) + [540]=> + int(0) + [541]=> + int(0) + [542]=> + int(0) + [543]=> + int(0) + [544]=> + int(0) + [545]=> + int(0) + [546]=> + int(0) + [547]=> + int(0) + [548]=> + int(0) + [549]=> + int(0) + [550]=> + int(0) + [551]=> + int(0) + [552]=> + int(51766) + [553]=> + int(1946) + [554]=> + int(0) + [555]=> + int(24609) + [556]=> + int(1088) + [557]=> + int(960) + [558]=> + int(0) + [559]=> + int(0) + [560]=> + int(0) + [561]=> + int(0) + [562]=> + int(25116) + [563]=> + int(2012) + [564]=> + int(0) + [565]=> + int(0) + [566]=> + int(0) + [567]=> + int(0) + [568]=> + int(0) + [569]=> + int(0) + [570]=> + int(0) + [571]=> + int(0) + [572]=> + int(0) + [573]=> + int(0) + [574]=> + int(0) + [575]=> + int(0) + [576]=> + int(0) + [577]=> + int(0) + [578]=> + int(0) + [579]=> + int(0) + [580]=> + int(0) + [581]=> + int(0) + [582]=> + int(0) + [583]=> + int(0) + [584]=> + int(0) + [585]=> + int(0) + [586]=> + int(0) + [587]=> + int(0) + [588]=> + int(0) + [589]=> + int(0) + [590]=> + int(0) + [591]=> + int(0) + [592]=> + int(0) + [593]=> + int(0) + [594]=> + int(0) + [595]=> + int(0) + [596]=> + int(0) + [597]=> + int(0) + [598]=> + int(0) + [599]=> + int(0) + [600]=> + int(0) + [601]=> + int(0) + [602]=> + int(0) + [603]=> + int(0) + [604]=> + int(0) + [605]=> + int(0) + [606]=> + int(0) + [607]=> + int(0) + [608]=> + int(0) + [609]=> + int(0) + [610]=> + int(0) + [611]=> + int(0) + [612]=> + int(0) + [613]=> + int(0) + [614]=> + int(0) + [615]=> + int(0) + [616]=> + int(0) + [617]=> + int(0) + [618]=> + int(0) + [619]=> + int(0) + [620]=> + int(0) + [621]=> + int(0) + [622]=> + int(0) + [623]=> + int(0) + [624]=> + int(0) + [625]=> + int(0) + [626]=> + int(0) + [627]=> + int(0) + [628]=> + int(0) + [629]=> + int(0) + [630]=> + int(0) + [631]=> + int(0) + [632]=> + int(0) + [633]=> + int(0) + [634]=> + int(0) + [635]=> + int(0) + [636]=> + int(0) + [637]=> + int(0) + [638]=> + int(0) + [639]=> + int(0) + [640]=> + int(0) + [641]=> + int(0) + [642]=> + int(0) + [643]=> + int(0) + [644]=> + int(0) + [645]=> + int(0) + [646]=> + int(0) + [647]=> + int(0) + [648]=> + int(0) + [649]=> + int(0) + [650]=> + int(0) + [651]=> + int(0) + [652]=> + int(0) + [653]=> + int(0) + [654]=> + int(0) + [655]=> + int(0) + [656]=> + int(0) + [657]=> + int(0) + [658]=> + int(0) + [659]=> + int(0) + [660]=> + int(0) + [661]=> + int(0) + [662]=> + int(0) + [663]=> + int(0) + [664]=> + int(0) + [665]=> + int(0) + [666]=> + int(0) + [667]=> + int(0) + [668]=> + int(0) + [669]=> + int(0) + [670]=> + int(0) + [671]=> + int(0) + [672]=> + int(0) + [673]=> + int(0) + [674]=> + int(0) + [675]=> + int(0) + [676]=> + int(0) + [677]=> + int(0) + [678]=> + int(0) + [679]=> + int(0) + [680]=> + int(0) + [681]=> + int(0) + [682]=> + int(0) + [683]=> + int(0) + [684]=> + int(0) + [685]=> + int(0) + [686]=> + int(0) + [687]=> + int(0) + [688]=> + int(0) + [689]=> + int(0) + [690]=> + int(0) + [691]=> + int(0) + [692]=> + int(0) + [693]=> + int(0) + [694]=> + int(0) + [695]=> + int(0) + [696]=> + int(0) + [697]=> + int(0) + [698]=> + int(0) + [699]=> + int(0) + [700]=> + int(0) + [701]=> + int(0) + [702]=> + int(0) + [703]=> + int(0) + [704]=> + int(0) + [705]=> + int(0) + [706]=> + int(0) + [707]=> + int(0) + [708]=> + int(0) + [709]=> + int(0) + [710]=> + int(0) + [711]=> + int(0) + [712]=> + int(0) + [713]=> + int(0) + [714]=> + int(0) + [715]=> + int(0) + [716]=> + int(0) + [717]=> + int(0) + [718]=> + int(0) + [719]=> + int(0) + [720]=> + int(0) + [721]=> + int(0) + [722]=> + int(0) + [723]=> + int(0) + [724]=> + int(0) + [725]=> + int(0) + [726]=> + int(0) + [727]=> + int(0) + [728]=> + int(0) + [729]=> + int(0) + [730]=> + int(0) + [731]=> + int(0) + [732]=> + int(0) + [733]=> + int(0) + [734]=> + int(0) + [735]=> + int(0) + [736]=> + int(0) + [737]=> + int(0) + [738]=> + int(0) + [739]=> + int(0) + [740]=> + int(0) + [741]=> + int(0) + [742]=> + int(0) + [743]=> + int(0) + [744]=> + int(0) + [745]=> + int(0) + [746]=> + int(0) + [747]=> + int(0) + [748]=> + int(0) + [749]=> + int(0) + [750]=> + int(0) + [751]=> + int(0) + [752]=> + int(0) + [753]=> + int(0) + [754]=> + int(0) + [755]=> + int(0) + [756]=> + int(0) + [757]=> + int(0) + [758]=> + int(0) + [759]=> + int(0) + [760]=> + int(0) + [761]=> + int(0) + [762]=> + int(0) + [763]=> + int(0) + [764]=> + int(0) + [765]=> + int(0) + [766]=> + int(0) + [767]=> + int(0) + } + ["Copyright"]=> + string(12) "Eric Stewart" + ["ExposureTime"]=> + string(5) "1/125" + ["FNumber"]=> + string(3) "8/1" + ["ISOSpeedRatings"]=> + int(80) + ["DateTimeOriginal"]=> + string(19) "2008:06:19 01:47:53" + ["DateTimeDigitized"]=> + string(19) "2008:06:19 01:47:53" + ["MeteringMode"]=> + int(5) + ["LightSource"]=> + int(4) + ["Flash"]=> + int(7) + ["FocalLength"]=> + string(4) "29/5" + ["ExifImageWidth"]=> + int(1) + ["ExifImageLength"]=> + int(1) +} +--CREDIT-- +Eric Stewart <ericleestewart@gmail.com> diff --git a/ext/exif/tests/exif020.phpt b/ext/exif/tests/exif020.phpt new file mode 100644 index 0000000..c6bb13c --- /dev/null +++ b/ext/exif/tests/exif020.phpt @@ -0,0 +1,1659 @@ +--TEST-- +Check for exif_read_data, TIFF with IFD and GPS data in Intel byte-order. +--SKIPIF-- +<?php if (!extension_loaded('exif')) print 'skip exif extension not available';?> +--INI-- +output_handler= +zlib.output_compression=0 +--FILE-- +<?php +var_dump(exif_read_data(dirname(__FILE__).'/image020.tiff')); +?> +--EXPECTF-- +array(34) { + ["FileName"]=> + string(13) "image020.tiff" + ["FileDateTime"]=> + int(%d) + ["FileSize"]=> + int(%d) + ["FileType"]=> + int(7) + ["MimeType"]=> + string(10) "image/tiff" + ["SectionsFound"]=> + string(18) "ANY_TAG, IFD0, GPS" + ["COMPUTED"]=> + array(8) { + ["html"]=> + string(20) "width="1" height="1"" + ["Height"]=> + int(1) + ["Width"]=> + int(1) + ["IsColor"]=> + int(1) + ["ByteOrderMotorola"]=> + int(0) + ["Copyright"]=> + string(24) "Eric Stewart, Hex Editor" + ["Copyright.Photographer"]=> + string(12) "Eric Stewart" + ["Copyright.Editor"]=> + string(10) "Hex Editor" + } + ["ImageWidth"]=> + int(1) + ["ImageLength"]=> + int(1) + ["BitsPerSample"]=> + int(8) + ["Compression"]=> + int(5) + ["PhotometricInterpretation"]=> + int(3) + ["ImageDescription"]=> + string(15) "My description." + ["Make"]=> + string(11) "OpenShutter" + ["Model"]=> + string(8) "OS 1.0.0" + ["StripOffsets"]=> + int(2064) + ["SamplesPerPixel"]=> + int(1) + ["RowsPerStrip"]=> + int(8) + ["StripByteCounts"]=> + int(4) + ["XResolution"]=> + string(17) "381681664/2097152" + ["YResolution"]=> + string(17) "381681664/2097152" + ["PlanarConfiguration"]=> + int(1) + ["ResolutionUnit"]=> + int(2) + ["Artist"]=> + string(12) "Eric Stewart" + ["ColorMap"]=> + array(768) { + [0]=> + int(0) + [1]=> + int(65280) + [2]=> + int(32512) + [3]=> + int(49152) + [4]=> + int(99) + [5]=> + int(115) + [6]=> + int(116) + [7]=> + int(101) + [8]=> + int(119) + [9]=> + int(97) + [10]=> + int(114) + [11]=> + int(116) + [12]=> + int(0) + [13]=> + int(0) + [14]=> + int(0) + [15]=> + int(0) + [16]=> + int(0) + [17]=> + int(0) + [18]=> + int(0) + [19]=> + int(0) + [20]=> + int(0) + [21]=> + int(0) + [22]=> + int(0) + [23]=> + int(0) + [24]=> + int(0) + [25]=> + int(0) + [26]=> + int(0) + [27]=> + int(0) + [28]=> + int(0) + [29]=> + int(0) + [30]=> + int(0) + [31]=> + int(0) + [32]=> + int(0) + [33]=> + int(0) + [34]=> + int(0) + [35]=> + int(0) + [36]=> + int(0) + [37]=> + int(0) + [38]=> + int(0) + [39]=> + int(0) + [40]=> + int(0) + [41]=> + int(0) + [42]=> + int(0) + [43]=> + int(0) + [44]=> + int(0) + [45]=> + int(0) + [46]=> + int(0) + [47]=> + int(0) + [48]=> + int(0) + [49]=> + int(0) + [50]=> + int(0) + [51]=> + int(0) + [52]=> + int(0) + [53]=> + int(0) + [54]=> + int(0) + [55]=> + int(0) + [56]=> + int(0) + [57]=> + int(0) + [58]=> + int(0) + [59]=> + int(0) + [60]=> + int(0) + [61]=> + int(0) + [62]=> + int(0) + [63]=> + int(0) + [64]=> + int(0) + [65]=> + int(0) + [66]=> + int(0) + [67]=> + int(0) + [68]=> + int(0) + [69]=> + int(0) + [70]=> + int(0) + [71]=> + int(0) + [72]=> + int(0) + [73]=> + int(0) + [74]=> + int(0) + [75]=> + int(0) + [76]=> + int(0) + [77]=> + int(0) + [78]=> + int(0) + [79]=> + int(0) + [80]=> + int(0) + [81]=> + int(0) + [82]=> + int(0) + [83]=> + int(0) + [84]=> + int(0) + [85]=> + int(0) + [86]=> + int(0) + [87]=> + int(0) + [88]=> + int(0) + [89]=> + int(0) + [90]=> + int(0) + [91]=> + int(0) + [92]=> + int(0) + [93]=> + int(0) + [94]=> + int(0) + [95]=> + int(0) + [96]=> + int(0) + [97]=> + int(0) + [98]=> + int(0) + [99]=> + int(0) + [100]=> + int(0) + [101]=> + int(0) + [102]=> + int(0) + [103]=> + int(0) + [104]=> + int(0) + [105]=> + int(0) + [106]=> + int(0) + [107]=> + int(0) + [108]=> + int(0) + [109]=> + int(0) + [110]=> + int(0) + [111]=> + int(0) + [112]=> + int(0) + [113]=> + int(0) + [114]=> + int(0) + [115]=> + int(0) + [116]=> + int(0) + [117]=> + int(0) + [118]=> + int(0) + [119]=> + int(0) + [120]=> + int(0) + [121]=> + int(0) + [122]=> + int(0) + [123]=> + int(0) + [124]=> + int(0) + [125]=> + int(0) + [126]=> + int(0) + [127]=> + int(0) + [128]=> + int(0) + [129]=> + int(0) + [130]=> + int(0) + [131]=> + int(0) + [132]=> + int(0) + [133]=> + int(0) + [134]=> + int(0) + [135]=> + int(0) + [136]=> + int(0) + [137]=> + int(0) + [138]=> + int(0) + [139]=> + int(0) + [140]=> + int(0) + [141]=> + int(0) + [142]=> + int(0) + [143]=> + int(0) + [144]=> + int(0) + [145]=> + int(0) + [146]=> + int(0) + [147]=> + int(0) + [148]=> + int(0) + [149]=> + int(0) + [150]=> + int(0) + [151]=> + int(0) + [152]=> + int(0) + [153]=> + int(0) + [154]=> + int(0) + [155]=> + int(0) + [156]=> + int(0) + [157]=> + int(0) + [158]=> + int(0) + [159]=> + int(0) + [160]=> + int(0) + [161]=> + int(0) + [162]=> + int(0) + [163]=> + int(0) + [164]=> + int(0) + [165]=> + int(0) + [166]=> + int(0) + [167]=> + int(0) + [168]=> + int(0) + [169]=> + int(0) + [170]=> + int(0) + [171]=> + int(0) + [172]=> + int(0) + [173]=> + int(0) + [174]=> + int(0) + [175]=> + int(0) + [176]=> + int(0) + [177]=> + int(0) + [178]=> + int(0) + [179]=> + int(0) + [180]=> + int(0) + [181]=> + int(0) + [182]=> + int(0) + [183]=> + int(0) + [184]=> + int(0) + [185]=> + int(0) + [186]=> + int(0) + [187]=> + int(0) + [188]=> + int(0) + [189]=> + int(0) + [190]=> + int(0) + [191]=> + int(0) + [192]=> + int(0) + [193]=> + int(0) + [194]=> + int(0) + [195]=> + int(0) + [196]=> + int(0) + [197]=> + int(0) + [198]=> + int(0) + [199]=> + int(0) + [200]=> + int(0) + [201]=> + int(0) + [202]=> + int(0) + [203]=> + int(0) + [204]=> + int(0) + [205]=> + int(0) + [206]=> + int(0) + [207]=> + int(0) + [208]=> + int(0) + [209]=> + int(0) + [210]=> + int(0) + [211]=> + int(0) + [212]=> + int(0) + [213]=> + int(0) + [214]=> + int(0) + [215]=> + int(0) + [216]=> + int(0) + [217]=> + int(0) + [218]=> + int(0) + [219]=> + int(0) + [220]=> + int(0) + [221]=> + int(0) + [222]=> + int(0) + [223]=> + int(0) + [224]=> + int(0) + [225]=> + int(0) + [226]=> + int(0) + [227]=> + int(0) + [228]=> + int(0) + [229]=> + int(0) + [230]=> + int(0) + [231]=> + int(0) + [232]=> + int(0) + [233]=> + int(0) + [234]=> + int(0) + [235]=> + int(0) + [236]=> + int(0) + [237]=> + int(0) + [238]=> + int(0) + [239]=> + int(0) + [240]=> + int(0) + [241]=> + int(0) + [242]=> + int(0) + [243]=> + int(0) + [244]=> + int(0) + [245]=> + int(0) + [246]=> + int(0) + [247]=> + int(0) + [248]=> + int(0) + [249]=> + int(0) + [250]=> + int(0) + [251]=> + int(0) + [252]=> + int(0) + [253]=> + int(0) + [254]=> + int(0) + [255]=> + int(1) + [256]=> + int(0) + [257]=> + int(65280) + [258]=> + int(32512) + [259]=> + int(49152) + [260]=> + int(0) + [261]=> + int(0) + [262]=> + int(0) + [263]=> + int(0) + [264]=> + int(0) + [265]=> + int(0) + [266]=> + int(0) + [267]=> + int(0) + [268]=> + int(0) + [269]=> + int(0) + [270]=> + int(0) + [271]=> + int(0) + [272]=> + int(11945) + [273]=> + int(1914) + [274]=> + int(0) + [275]=> + int(24609) + [276]=> + int(1088) + [277]=> + int(960) + [278]=> + int(0) + [279]=> + int(0) + [280]=> + int(20000) + [281]=> + int(8414) + [282]=> + int(65436) + [283]=> + int(0) + [284]=> + int(47655) + [285]=> + int(8) + [286]=> + int(37936) + [287]=> + int(8406) + [288]=> + int(0) + [289]=> + int(0) + [290]=> + int(0) + [291]=> + int(0) + [292]=> + int(0) + [293]=> + int(0) + [294]=> + int(0) + [295]=> + int(0) + [296]=> + int(0) + [297]=> + int(64652) + [298]=> + int(50264) + [299]=> + int(0) + [300]=> + int(0) + [301]=> + int(64887) + [302]=> + int(50264) + [303]=> + int(0) + [304]=> + int(25714) + [305]=> + int(26220) + [306]=> + int(17235) + [307]=> + int(19777) + [308]=> + int(65535) + [309]=> + int(65535) + [310]=> + int(65535) + [311]=> + int(65535) + [312]=> + int(65535) + [313]=> + int(65535) + [314]=> + int(65535) + [315]=> + int(65535) + [316]=> + int(501) + [317]=> + int(0) + [318]=> + int(20) + [319]=> + int(0) + [320]=> + int(0) + [321]=> + int(0) + [322]=> + int(16877) + [323]=> + int(0) + [324]=> + int(3) + [325]=> + int(0) + [326]=> + int(0) + [327]=> + int(0) + [328]=> + int(0) + [329]=> + int(0) + [330]=> + int(0) + [331]=> + int(0) + [332]=> + int(65535) + [333]=> + int(65535) + [334]=> + int(65535) + [335]=> + int(65535) + [336]=> + int(65535) + [337]=> + int(65535) + [338]=> + int(65535) + [339]=> + int(65535) + [340]=> + int(0) + [341]=> + int(0) + [342]=> + int(52840) + [343]=> + int(2025) + [344]=> + int(16) + [345]=> + int(57377) + [346]=> + int(1024) + [347]=> + int(960) + [348]=> + int(0) + [349]=> + int(0) + [350]=> + int(27136) + [351]=> + int(8414) + [352]=> + int(65436) + [353]=> + int(0) + [354]=> + int(47655) + [355]=> + int(8) + [356]=> + int(62400) + [357]=> + int(8407) + [358]=> + int(0) + [359]=> + int(0) + [360]=> + int(0) + [361]=> + int(0) + [362]=> + int(0) + [363]=> + int(0) + [364]=> + int(0) + [365]=> + int(0) + [366]=> + int(0) + [367]=> + int(64857) + [368]=> + int(50264) + [369]=> + int(0) + [370]=> + int(0) + [371]=> + int(64892) + [372]=> + int(50264) + [373]=> + int(0) + [374]=> + int(25714) + [375]=> + int(26220) + [376]=> + int(17235) + [377]=> + int(19777) + [378]=> + int(65535) + [379]=> + int(65535) + [380]=> + int(65535) + [381]=> + int(65535) + [382]=> + int(65535) + [383]=> + int(65535) + [384]=> + int(65535) + [385]=> + int(65535) + [386]=> + int(501) + [387]=> + int(0) + [388]=> + int(20) + [389]=> + int(0) + [390]=> + int(0) + [391]=> + int(0) + [392]=> + int(16877) + [393]=> + int(0) + [394]=> + int(3) + [395]=> + int(0) + [396]=> + int(0) + [397]=> + int(0) + [398]=> + int(0) + [399]=> + int(0) + [400]=> + int(0) + [401]=> + int(0) + [402]=> + int(65535) + [403]=> + int(65535) + [404]=> + int(65535) + [405]=> + int(65535) + [406]=> + int(65535) + [407]=> + int(65535) + [408]=> + int(65535) + [409]=> + int(65535) + [410]=> + int(0) + [411]=> + int(0) + [412]=> + int(53440) + [413]=> + int(2025) + [414]=> + int(16) + [415]=> + int(57377) + [416]=> + int(1024) + [417]=> + int(960) + [418]=> + int(0) + [419]=> + int(0) + [420]=> + int(41120) + [421]=> + int(9024) + [422]=> + int(65436) + [423]=> + int(0) + [424]=> + int(47655) + [425]=> + int(8) + [426]=> + int(24480) + [427]=> + int(8404) + [428]=> + int(0) + [429]=> + int(0) + [430]=> + int(0) + [431]=> + int(0) + [432]=> + int(0) + [433]=> + int(0) + [434]=> + int(0) + [435]=> + int(0) + [436]=> + int(0) + [437]=> + int(21315) + [438]=> + int(50294) + [439]=> + int(0) + [440]=> + int(0) + [441]=> + int(53635) + [442]=> + int(50294) + [443]=> + int(0) + [444]=> + int(25714) + [445]=> + int(26220) + [446]=> + int(17235) + [447]=> + int(19777) + [448]=> + int(65535) + [449]=> + int(65535) + [450]=> + int(65535) + [451]=> + int(65535) + [452]=> + int(65535) + [453]=> + int(65535) + [454]=> + int(65535) + [455]=> + int(65535) + [456]=> + int(501) + [457]=> + int(0) + [458]=> + int(20) + [459]=> + int(0) + [460]=> + int(0) + [461]=> + int(0) + [462]=> + int(16877) + [463]=> + int(0) + [464]=> + int(3) + [465]=> + int(0) + [466]=> + int(0) + [467]=> + int(0) + [468]=> + int(0) + [469]=> + int(0) + [470]=> + int(0) + [471]=> + int(0) + [472]=> + int(65535) + [473]=> + int(65535) + [474]=> + int(65535) + [475]=> + int(65535) + [476]=> + int(65535) + [477]=> + int(65535) + [478]=> + int(65535) + [479]=> + int(65535) + [480]=> + int(0) + [481]=> + int(0) + [482]=> + int(54028) + [483]=> + int(2772) + [484]=> + int(16) + [485]=> + int(57377) + [486]=> + int(1024) + [487]=> + int(960) + [488]=> + int(0) + [489]=> + int(0) + [490]=> + int(42384) + [491]=> + int(8408) + [492]=> + int(65436) + [493]=> + int(0) + [494]=> + int(47655) + [495]=> + int(8) + [496]=> + int(1136) + [497]=> + int(8348) + [498]=> + int(0) + [499]=> + int(0) + [500]=> + int(0) + [501]=> + int(0) + [502]=> + int(0) + [503]=> + int(0) + [504]=> + int(0) + [505]=> + int(0) + [506]=> + int(0) + [507]=> + int(12326) + [508]=> + int(50261) + [509]=> + int(0) + [510]=> + int(0) + [511]=> + int(12326) + [512]=> + int(0) + [513]=> + int(65280) + [514]=> + int(32512) + [515]=> + int(49152) + [516]=> + int(0) + [517]=> + int(0) + [518]=> + int(22663) + [519]=> + int(2) + [520]=> + int(0) + [521]=> + int(0) + [522]=> + int(24576) + [523]=> + int(2) + [524]=> + int(0) + [525]=> + int(0) + [526]=> + int(501) + [527]=> + int(0) + [528]=> + int(20) + [529]=> + int(0) + [530]=> + int(0) + [531]=> + int(0) + [532]=> + int(33188) + [533]=> + int(0) + [534]=> + int(0) + [535]=> + int(0) + [536]=> + int(0) + [537]=> + int(0) + [538]=> + int(0) + [539]=> + int(0) + [540]=> + int(0) + [541]=> + int(0) + [542]=> + int(0) + [543]=> + int(0) + [544]=> + int(0) + [545]=> + int(0) + [546]=> + int(0) + [547]=> + int(0) + [548]=> + int(0) + [549]=> + int(0) + [550]=> + int(0) + [551]=> + int(0) + [552]=> + int(51766) + [553]=> + int(1946) + [554]=> + int(0) + [555]=> + int(24609) + [556]=> + int(1088) + [557]=> + int(960) + [558]=> + int(0) + [559]=> + int(0) + [560]=> + int(0) + [561]=> + int(0) + [562]=> + int(25116) + [563]=> + int(2012) + [564]=> + int(0) + [565]=> + int(0) + [566]=> + int(0) + [567]=> + int(0) + [568]=> + int(0) + [569]=> + int(0) + [570]=> + int(0) + [571]=> + int(0) + [572]=> + int(0) + [573]=> + int(0) + [574]=> + int(0) + [575]=> + int(0) + [576]=> + int(0) + [577]=> + int(0) + [578]=> + int(0) + [579]=> + int(0) + [580]=> + int(0) + [581]=> + int(0) + [582]=> + int(0) + [583]=> + int(0) + [584]=> + int(0) + [585]=> + int(0) + [586]=> + int(0) + [587]=> + int(0) + [588]=> + int(0) + [589]=> + int(0) + [590]=> + int(0) + [591]=> + int(0) + [592]=> + int(0) + [593]=> + int(0) + [594]=> + int(0) + [595]=> + int(0) + [596]=> + int(0) + [597]=> + int(0) + [598]=> + int(0) + [599]=> + int(0) + [600]=> + int(0) + [601]=> + int(0) + [602]=> + int(0) + [603]=> + int(0) + [604]=> + int(0) + [605]=> + int(0) + [606]=> + int(0) + [607]=> + int(0) + [608]=> + int(0) + [609]=> + int(0) + [610]=> + int(0) + [611]=> + int(0) + [612]=> + int(0) + [613]=> + int(0) + [614]=> + int(0) + [615]=> + int(0) + [616]=> + int(0) + [617]=> + int(0) + [618]=> + int(0) + [619]=> + int(0) + [620]=> + int(0) + [621]=> + int(0) + [622]=> + int(0) + [623]=> + int(0) + [624]=> + int(0) + [625]=> + int(0) + [626]=> + int(0) + [627]=> + int(0) + [628]=> + int(0) + [629]=> + int(0) + [630]=> + int(0) + [631]=> + int(0) + [632]=> + int(0) + [633]=> + int(0) + [634]=> + int(0) + [635]=> + int(0) + [636]=> + int(0) + [637]=> + int(0) + [638]=> + int(0) + [639]=> + int(0) + [640]=> + int(0) + [641]=> + int(0) + [642]=> + int(0) + [643]=> + int(0) + [644]=> + int(0) + [645]=> + int(0) + [646]=> + int(0) + [647]=> + int(0) + [648]=> + int(0) + [649]=> + int(0) + [650]=> + int(0) + [651]=> + int(0) + [652]=> + int(0) + [653]=> + int(0) + [654]=> + int(0) + [655]=> + int(0) + [656]=> + int(0) + [657]=> + int(0) + [658]=> + int(0) + [659]=> + int(0) + [660]=> + int(0) + [661]=> + int(0) + [662]=> + int(0) + [663]=> + int(0) + [664]=> + int(0) + [665]=> + int(0) + [666]=> + int(0) + [667]=> + int(0) + [668]=> + int(0) + [669]=> + int(0) + [670]=> + int(0) + [671]=> + int(0) + [672]=> + int(0) + [673]=> + int(0) + [674]=> + int(0) + [675]=> + int(0) + [676]=> + int(0) + [677]=> + int(0) + [678]=> + int(0) + [679]=> + int(0) + [680]=> + int(0) + [681]=> + int(0) + [682]=> + int(0) + [683]=> + int(0) + [684]=> + int(0) + [685]=> + int(0) + [686]=> + int(0) + [687]=> + int(0) + [688]=> + int(0) + [689]=> + int(0) + [690]=> + int(0) + [691]=> + int(0) + [692]=> + int(0) + [693]=> + int(0) + [694]=> + int(0) + [695]=> + int(0) + [696]=> + int(0) + [697]=> + int(0) + [698]=> + int(0) + [699]=> + int(0) + [700]=> + int(0) + [701]=> + int(0) + [702]=> + int(0) + [703]=> + int(0) + [704]=> + int(0) + [705]=> + int(0) + [706]=> + int(0) + [707]=> + int(0) + [708]=> + int(0) + [709]=> + int(0) + [710]=> + int(0) + [711]=> + int(0) + [712]=> + int(0) + [713]=> + int(0) + [714]=> + int(0) + [715]=> + int(0) + [716]=> + int(0) + [717]=> + int(0) + [718]=> + int(0) + [719]=> + int(0) + [720]=> + int(0) + [721]=> + int(0) + [722]=> + int(0) + [723]=> + int(0) + [724]=> + int(0) + [725]=> + int(0) + [726]=> + int(0) + [727]=> + int(0) + [728]=> + int(0) + [729]=> + int(0) + [730]=> + int(0) + [731]=> + int(0) + [732]=> + int(0) + [733]=> + int(0) + [734]=> + int(0) + [735]=> + int(0) + [736]=> + int(0) + [737]=> + int(0) + [738]=> + int(0) + [739]=> + int(0) + [740]=> + int(0) + [741]=> + int(0) + [742]=> + int(0) + [743]=> + int(0) + [744]=> + int(0) + [745]=> + int(0) + [746]=> + int(0) + [747]=> + int(0) + [748]=> + int(0) + [749]=> + int(0) + [750]=> + int(0) + [751]=> + int(0) + [752]=> + int(0) + [753]=> + int(0) + [754]=> + int(0) + [755]=> + int(0) + [756]=> + int(0) + [757]=> + int(0) + [758]=> + int(0) + [759]=> + int(0) + [760]=> + int(0) + [761]=> + int(0) + [762]=> + int(0) + [763]=> + int(0) + [764]=> + int(0) + [765]=> + int(0) + [766]=> + int(0) + [767]=> + int(0) + } + ["Copyright"]=> + string(12) "Eric Stewart" + ["GPSVersion"]=> + string(4) " + ["GPSLatitudeRef"]=> + string(1) "N" + ["GPSLatitude"]=> + array(3) { + [0]=> + string(4) "33/1" + [1]=> + string(4) "37/1" + [2]=> + string(3) "0/1" + } + ["GPSLongitudeRef"]=> + string(1) "W" + ["GPSLongitude"]=> + array(3) { + [0]=> + string(4) "84/1" + [1]=> + string(3) "7/1" + [2]=> + string(3) "0/1" + } + ["GPSAltitudeRef"]=> + string(1) " + ["GPSAltitude"]=> + string(5) "295/1" + ["GPSTimeStamp"]=> + array(3) { + [0]=> + string(3) "1/1" + [1]=> + string(4) "47/1" + [2]=> + string(4) "53/1" + } +} +--CREDIT-- +Eric Stewart <ericleestewart@gmail.com> diff --git a/ext/exif/tests/exif021.phpt b/ext/exif/tests/exif021.phpt new file mode 100644 index 0000000..2cf446b --- /dev/null +++ b/ext/exif/tests/exif021.phpt @@ -0,0 +1,1659 @@ +--TEST-- +Check for exif_read_data, TIFF with IFD and GPS data in Motorola byte-order. +--SKIPIF-- +<?php if (!extension_loaded('exif')) print 'skip exif extension not available';?> +--INI-- +output_handler= +zlib.output_compression=0 +--FILE-- +<?php +var_dump(exif_read_data(dirname(__FILE__).'/image021.tiff')); +?> +--EXPECTF-- +array(34) { + ["FileName"]=> + string(13) "image021.tiff" + ["FileDateTime"]=> + int(%d) + ["FileSize"]=> + int(%d) + ["FileType"]=> + int(8) + ["MimeType"]=> + string(10) "image/tiff" + ["SectionsFound"]=> + string(18) "ANY_TAG, IFD0, GPS" + ["COMPUTED"]=> + array(8) { + ["html"]=> + string(20) "width="1" height="1"" + ["Height"]=> + int(1) + ["Width"]=> + int(1) + ["IsColor"]=> + int(1) + ["ByteOrderMotorola"]=> + int(1) + ["Copyright"]=> + string(24) "Eric Stewart, Hex Editor" + ["Copyright.Photographer"]=> + string(12) "Eric Stewart" + ["Copyright.Editor"]=> + string(10) "Hex Editor" + } + ["ImageWidth"]=> + int(1) + ["ImageLength"]=> + int(1) + ["BitsPerSample"]=> + int(8) + ["Compression"]=> + int(5) + ["PhotometricInterpretation"]=> + int(3) + ["ImageDescription"]=> + string(15) "My description." + ["Make"]=> + string(11) "OpenShutter" + ["Model"]=> + string(8) "OS 1.0.0" + ["StripOffsets"]=> + int(2064) + ["SamplesPerPixel"]=> + int(1) + ["RowsPerStrip"]=> + int(8) + ["StripByteCounts"]=> + int(4) + ["XResolution"]=> + string(17) "381681664/2097152" + ["YResolution"]=> + string(17) "381681664/2097152" + ["PlanarConfiguration"]=> + int(1) + ["ResolutionUnit"]=> + int(2) + ["Artist"]=> + string(12) "Eric Stewart" + ["ColorMap"]=> + array(768) { + [0]=> + int(0) + [1]=> + int(65280) + [2]=> + int(32512) + [3]=> + int(49152) + [4]=> + int(99) + [5]=> + int(115) + [6]=> + int(116) + [7]=> + int(101) + [8]=> + int(119) + [9]=> + int(97) + [10]=> + int(114) + [11]=> + int(116) + [12]=> + int(0) + [13]=> + int(0) + [14]=> + int(0) + [15]=> + int(0) + [16]=> + int(0) + [17]=> + int(0) + [18]=> + int(0) + [19]=> + int(0) + [20]=> + int(0) + [21]=> + int(0) + [22]=> + int(0) + [23]=> + int(0) + [24]=> + int(0) + [25]=> + int(0) + [26]=> + int(0) + [27]=> + int(0) + [28]=> + int(0) + [29]=> + int(0) + [30]=> + int(0) + [31]=> + int(0) + [32]=> + int(0) + [33]=> + int(0) + [34]=> + int(0) + [35]=> + int(0) + [36]=> + int(0) + [37]=> + int(0) + [38]=> + int(0) + [39]=> + int(0) + [40]=> + int(0) + [41]=> + int(0) + [42]=> + int(0) + [43]=> + int(0) + [44]=> + int(0) + [45]=> + int(0) + [46]=> + int(0) + [47]=> + int(0) + [48]=> + int(0) + [49]=> + int(0) + [50]=> + int(0) + [51]=> + int(0) + [52]=> + int(0) + [53]=> + int(0) + [54]=> + int(0) + [55]=> + int(0) + [56]=> + int(0) + [57]=> + int(0) + [58]=> + int(0) + [59]=> + int(0) + [60]=> + int(0) + [61]=> + int(0) + [62]=> + int(0) + [63]=> + int(0) + [64]=> + int(0) + [65]=> + int(0) + [66]=> + int(0) + [67]=> + int(0) + [68]=> + int(0) + [69]=> + int(0) + [70]=> + int(0) + [71]=> + int(0) + [72]=> + int(0) + [73]=> + int(0) + [74]=> + int(0) + [75]=> + int(0) + [76]=> + int(0) + [77]=> + int(0) + [78]=> + int(0) + [79]=> + int(0) + [80]=> + int(0) + [81]=> + int(0) + [82]=> + int(0) + [83]=> + int(0) + [84]=> + int(0) + [85]=> + int(0) + [86]=> + int(0) + [87]=> + int(0) + [88]=> + int(0) + [89]=> + int(0) + [90]=> + int(0) + [91]=> + int(0) + [92]=> + int(0) + [93]=> + int(0) + [94]=> + int(0) + [95]=> + int(0) + [96]=> + int(0) + [97]=> + int(0) + [98]=> + int(0) + [99]=> + int(0) + [100]=> + int(0) + [101]=> + int(0) + [102]=> + int(0) + [103]=> + int(0) + [104]=> + int(0) + [105]=> + int(0) + [106]=> + int(0) + [107]=> + int(0) + [108]=> + int(0) + [109]=> + int(0) + [110]=> + int(0) + [111]=> + int(0) + [112]=> + int(0) + [113]=> + int(0) + [114]=> + int(0) + [115]=> + int(0) + [116]=> + int(0) + [117]=> + int(0) + [118]=> + int(0) + [119]=> + int(0) + [120]=> + int(0) + [121]=> + int(0) + [122]=> + int(0) + [123]=> + int(0) + [124]=> + int(0) + [125]=> + int(0) + [126]=> + int(0) + [127]=> + int(0) + [128]=> + int(0) + [129]=> + int(0) + [130]=> + int(0) + [131]=> + int(0) + [132]=> + int(0) + [133]=> + int(0) + [134]=> + int(0) + [135]=> + int(0) + [136]=> + int(0) + [137]=> + int(0) + [138]=> + int(0) + [139]=> + int(0) + [140]=> + int(0) + [141]=> + int(0) + [142]=> + int(0) + [143]=> + int(0) + [144]=> + int(0) + [145]=> + int(0) + [146]=> + int(0) + [147]=> + int(0) + [148]=> + int(0) + [149]=> + int(0) + [150]=> + int(0) + [151]=> + int(0) + [152]=> + int(0) + [153]=> + int(0) + [154]=> + int(0) + [155]=> + int(0) + [156]=> + int(0) + [157]=> + int(0) + [158]=> + int(0) + [159]=> + int(0) + [160]=> + int(0) + [161]=> + int(0) + [162]=> + int(0) + [163]=> + int(0) + [164]=> + int(0) + [165]=> + int(0) + [166]=> + int(0) + [167]=> + int(0) + [168]=> + int(0) + [169]=> + int(0) + [170]=> + int(0) + [171]=> + int(0) + [172]=> + int(0) + [173]=> + int(0) + [174]=> + int(0) + [175]=> + int(0) + [176]=> + int(0) + [177]=> + int(0) + [178]=> + int(0) + [179]=> + int(0) + [180]=> + int(0) + [181]=> + int(0) + [182]=> + int(0) + [183]=> + int(0) + [184]=> + int(0) + [185]=> + int(0) + [186]=> + int(0) + [187]=> + int(0) + [188]=> + int(0) + [189]=> + int(0) + [190]=> + int(0) + [191]=> + int(0) + [192]=> + int(0) + [193]=> + int(0) + [194]=> + int(0) + [195]=> + int(0) + [196]=> + int(0) + [197]=> + int(0) + [198]=> + int(0) + [199]=> + int(0) + [200]=> + int(0) + [201]=> + int(0) + [202]=> + int(0) + [203]=> + int(0) + [204]=> + int(0) + [205]=> + int(0) + [206]=> + int(0) + [207]=> + int(0) + [208]=> + int(0) + [209]=> + int(0) + [210]=> + int(0) + [211]=> + int(0) + [212]=> + int(0) + [213]=> + int(0) + [214]=> + int(0) + [215]=> + int(0) + [216]=> + int(0) + [217]=> + int(0) + [218]=> + int(0) + [219]=> + int(0) + [220]=> + int(0) + [221]=> + int(0) + [222]=> + int(0) + [223]=> + int(0) + [224]=> + int(0) + [225]=> + int(0) + [226]=> + int(0) + [227]=> + int(0) + [228]=> + int(0) + [229]=> + int(0) + [230]=> + int(0) + [231]=> + int(0) + [232]=> + int(0) + [233]=> + int(0) + [234]=> + int(0) + [235]=> + int(0) + [236]=> + int(0) + [237]=> + int(0) + [238]=> + int(0) + [239]=> + int(0) + [240]=> + int(0) + [241]=> + int(0) + [242]=> + int(0) + [243]=> + int(0) + [244]=> + int(0) + [245]=> + int(0) + [246]=> + int(0) + [247]=> + int(0) + [248]=> + int(0) + [249]=> + int(0) + [250]=> + int(0) + [251]=> + int(0) + [252]=> + int(0) + [253]=> + int(0) + [254]=> + int(0) + [255]=> + int(1) + [256]=> + int(0) + [257]=> + int(65280) + [258]=> + int(32512) + [259]=> + int(49152) + [260]=> + int(0) + [261]=> + int(0) + [262]=> + int(0) + [263]=> + int(0) + [264]=> + int(0) + [265]=> + int(0) + [266]=> + int(0) + [267]=> + int(0) + [268]=> + int(0) + [269]=> + int(0) + [270]=> + int(0) + [271]=> + int(0) + [272]=> + int(11945) + [273]=> + int(1914) + [274]=> + int(0) + [275]=> + int(24609) + [276]=> + int(1088) + [277]=> + int(960) + [278]=> + int(0) + [279]=> + int(0) + [280]=> + int(20000) + [281]=> + int(8414) + [282]=> + int(65436) + [283]=> + int(0) + [284]=> + int(47655) + [285]=> + int(8) + [286]=> + int(37936) + [287]=> + int(8406) + [288]=> + int(0) + [289]=> + int(0) + [290]=> + int(0) + [291]=> + int(0) + [292]=> + int(0) + [293]=> + int(0) + [294]=> + int(0) + [295]=> + int(0) + [296]=> + int(0) + [297]=> + int(64652) + [298]=> + int(50264) + [299]=> + int(0) + [300]=> + int(0) + [301]=> + int(64887) + [302]=> + int(50264) + [303]=> + int(0) + [304]=> + int(25714) + [305]=> + int(26220) + [306]=> + int(17235) + [307]=> + int(19777) + [308]=> + int(65535) + [309]=> + int(65535) + [310]=> + int(65535) + [311]=> + int(65535) + [312]=> + int(65535) + [313]=> + int(65535) + [314]=> + int(65535) + [315]=> + int(65535) + [316]=> + int(501) + [317]=> + int(0) + [318]=> + int(20) + [319]=> + int(0) + [320]=> + int(0) + [321]=> + int(0) + [322]=> + int(16877) + [323]=> + int(0) + [324]=> + int(3) + [325]=> + int(0) + [326]=> + int(0) + [327]=> + int(0) + [328]=> + int(0) + [329]=> + int(0) + [330]=> + int(0) + [331]=> + int(0) + [332]=> + int(65535) + [333]=> + int(65535) + [334]=> + int(65535) + [335]=> + int(65535) + [336]=> + int(65535) + [337]=> + int(65535) + [338]=> + int(65535) + [339]=> + int(65535) + [340]=> + int(0) + [341]=> + int(0) + [342]=> + int(52840) + [343]=> + int(2025) + [344]=> + int(16) + [345]=> + int(57377) + [346]=> + int(1024) + [347]=> + int(960) + [348]=> + int(0) + [349]=> + int(0) + [350]=> + int(27136) + [351]=> + int(8414) + [352]=> + int(65436) + [353]=> + int(0) + [354]=> + int(47655) + [355]=> + int(8) + [356]=> + int(62400) + [357]=> + int(8407) + [358]=> + int(0) + [359]=> + int(0) + [360]=> + int(0) + [361]=> + int(0) + [362]=> + int(0) + [363]=> + int(0) + [364]=> + int(0) + [365]=> + int(0) + [366]=> + int(0) + [367]=> + int(64857) + [368]=> + int(50264) + [369]=> + int(0) + [370]=> + int(0) + [371]=> + int(64892) + [372]=> + int(50264) + [373]=> + int(0) + [374]=> + int(25714) + [375]=> + int(26220) + [376]=> + int(17235) + [377]=> + int(19777) + [378]=> + int(65535) + [379]=> + int(65535) + [380]=> + int(65535) + [381]=> + int(65535) + [382]=> + int(65535) + [383]=> + int(65535) + [384]=> + int(65535) + [385]=> + int(65535) + [386]=> + int(501) + [387]=> + int(0) + [388]=> + int(20) + [389]=> + int(0) + [390]=> + int(0) + [391]=> + int(0) + [392]=> + int(16877) + [393]=> + int(0) + [394]=> + int(3) + [395]=> + int(0) + [396]=> + int(0) + [397]=> + int(0) + [398]=> + int(0) + [399]=> + int(0) + [400]=> + int(0) + [401]=> + int(0) + [402]=> + int(65535) + [403]=> + int(65535) + [404]=> + int(65535) + [405]=> + int(65535) + [406]=> + int(65535) + [407]=> + int(65535) + [408]=> + int(65535) + [409]=> + int(65535) + [410]=> + int(0) + [411]=> + int(0) + [412]=> + int(53440) + [413]=> + int(2025) + [414]=> + int(16) + [415]=> + int(57377) + [416]=> + int(1024) + [417]=> + int(960) + [418]=> + int(0) + [419]=> + int(0) + [420]=> + int(41120) + [421]=> + int(9024) + [422]=> + int(65436) + [423]=> + int(0) + [424]=> + int(47655) + [425]=> + int(8) + [426]=> + int(24480) + [427]=> + int(8404) + [428]=> + int(0) + [429]=> + int(0) + [430]=> + int(0) + [431]=> + int(0) + [432]=> + int(0) + [433]=> + int(0) + [434]=> + int(0) + [435]=> + int(0) + [436]=> + int(0) + [437]=> + int(21315) + [438]=> + int(50294) + [439]=> + int(0) + [440]=> + int(0) + [441]=> + int(53635) + [442]=> + int(50294) + [443]=> + int(0) + [444]=> + int(25714) + [445]=> + int(26220) + [446]=> + int(17235) + [447]=> + int(19777) + [448]=> + int(65535) + [449]=> + int(65535) + [450]=> + int(65535) + [451]=> + int(65535) + [452]=> + int(65535) + [453]=> + int(65535) + [454]=> + int(65535) + [455]=> + int(65535) + [456]=> + int(501) + [457]=> + int(0) + [458]=> + int(20) + [459]=> + int(0) + [460]=> + int(0) + [461]=> + int(0) + [462]=> + int(16877) + [463]=> + int(0) + [464]=> + int(3) + [465]=> + int(0) + [466]=> + int(0) + [467]=> + int(0) + [468]=> + int(0) + [469]=> + int(0) + [470]=> + int(0) + [471]=> + int(0) + [472]=> + int(65535) + [473]=> + int(65535) + [474]=> + int(65535) + [475]=> + int(65535) + [476]=> + int(65535) + [477]=> + int(65535) + [478]=> + int(65535) + [479]=> + int(65535) + [480]=> + int(0) + [481]=> + int(0) + [482]=> + int(54028) + [483]=> + int(2772) + [484]=> + int(16) + [485]=> + int(57377) + [486]=> + int(1024) + [487]=> + int(960) + [488]=> + int(0) + [489]=> + int(0) + [490]=> + int(42384) + [491]=> + int(8408) + [492]=> + int(65436) + [493]=> + int(0) + [494]=> + int(47655) + [495]=> + int(8) + [496]=> + int(1136) + [497]=> + int(8348) + [498]=> + int(0) + [499]=> + int(0) + [500]=> + int(0) + [501]=> + int(0) + [502]=> + int(0) + [503]=> + int(0) + [504]=> + int(0) + [505]=> + int(0) + [506]=> + int(0) + [507]=> + int(12326) + [508]=> + int(50261) + [509]=> + int(0) + [510]=> + int(0) + [511]=> + int(12326) + [512]=> + int(0) + [513]=> + int(65280) + [514]=> + int(32512) + [515]=> + int(49152) + [516]=> + int(0) + [517]=> + int(0) + [518]=> + int(22663) + [519]=> + int(2) + [520]=> + int(0) + [521]=> + int(0) + [522]=> + int(24576) + [523]=> + int(2) + [524]=> + int(0) + [525]=> + int(0) + [526]=> + int(501) + [527]=> + int(0) + [528]=> + int(20) + [529]=> + int(0) + [530]=> + int(0) + [531]=> + int(0) + [532]=> + int(33188) + [533]=> + int(0) + [534]=> + int(0) + [535]=> + int(0) + [536]=> + int(0) + [537]=> + int(0) + [538]=> + int(0) + [539]=> + int(0) + [540]=> + int(0) + [541]=> + int(0) + [542]=> + int(0) + [543]=> + int(0) + [544]=> + int(0) + [545]=> + int(0) + [546]=> + int(0) + [547]=> + int(0) + [548]=> + int(0) + [549]=> + int(0) + [550]=> + int(0) + [551]=> + int(0) + [552]=> + int(51766) + [553]=> + int(1946) + [554]=> + int(0) + [555]=> + int(24609) + [556]=> + int(1088) + [557]=> + int(960) + [558]=> + int(0) + [559]=> + int(0) + [560]=> + int(0) + [561]=> + int(0) + [562]=> + int(25116) + [563]=> + int(2012) + [564]=> + int(0) + [565]=> + int(0) + [566]=> + int(0) + [567]=> + int(0) + [568]=> + int(0) + [569]=> + int(0) + [570]=> + int(0) + [571]=> + int(0) + [572]=> + int(0) + [573]=> + int(0) + [574]=> + int(0) + [575]=> + int(0) + [576]=> + int(0) + [577]=> + int(0) + [578]=> + int(0) + [579]=> + int(0) + [580]=> + int(0) + [581]=> + int(0) + [582]=> + int(0) + [583]=> + int(0) + [584]=> + int(0) + [585]=> + int(0) + [586]=> + int(0) + [587]=> + int(0) + [588]=> + int(0) + [589]=> + int(0) + [590]=> + int(0) + [591]=> + int(0) + [592]=> + int(0) + [593]=> + int(0) + [594]=> + int(0) + [595]=> + int(0) + [596]=> + int(0) + [597]=> + int(0) + [598]=> + int(0) + [599]=> + int(0) + [600]=> + int(0) + [601]=> + int(0) + [602]=> + int(0) + [603]=> + int(0) + [604]=> + int(0) + [605]=> + int(0) + [606]=> + int(0) + [607]=> + int(0) + [608]=> + int(0) + [609]=> + int(0) + [610]=> + int(0) + [611]=> + int(0) + [612]=> + int(0) + [613]=> + int(0) + [614]=> + int(0) + [615]=> + int(0) + [616]=> + int(0) + [617]=> + int(0) + [618]=> + int(0) + [619]=> + int(0) + [620]=> + int(0) + [621]=> + int(0) + [622]=> + int(0) + [623]=> + int(0) + [624]=> + int(0) + [625]=> + int(0) + [626]=> + int(0) + [627]=> + int(0) + [628]=> + int(0) + [629]=> + int(0) + [630]=> + int(0) + [631]=> + int(0) + [632]=> + int(0) + [633]=> + int(0) + [634]=> + int(0) + [635]=> + int(0) + [636]=> + int(0) + [637]=> + int(0) + [638]=> + int(0) + [639]=> + int(0) + [640]=> + int(0) + [641]=> + int(0) + [642]=> + int(0) + [643]=> + int(0) + [644]=> + int(0) + [645]=> + int(0) + [646]=> + int(0) + [647]=> + int(0) + [648]=> + int(0) + [649]=> + int(0) + [650]=> + int(0) + [651]=> + int(0) + [652]=> + int(0) + [653]=> + int(0) + [654]=> + int(0) + [655]=> + int(0) + [656]=> + int(0) + [657]=> + int(0) + [658]=> + int(0) + [659]=> + int(0) + [660]=> + int(0) + [661]=> + int(0) + [662]=> + int(0) + [663]=> + int(0) + [664]=> + int(0) + [665]=> + int(0) + [666]=> + int(0) + [667]=> + int(0) + [668]=> + int(0) + [669]=> + int(0) + [670]=> + int(0) + [671]=> + int(0) + [672]=> + int(0) + [673]=> + int(0) + [674]=> + int(0) + [675]=> + int(0) + [676]=> + int(0) + [677]=> + int(0) + [678]=> + int(0) + [679]=> + int(0) + [680]=> + int(0) + [681]=> + int(0) + [682]=> + int(0) + [683]=> + int(0) + [684]=> + int(0) + [685]=> + int(0) + [686]=> + int(0) + [687]=> + int(0) + [688]=> + int(0) + [689]=> + int(0) + [690]=> + int(0) + [691]=> + int(0) + [692]=> + int(0) + [693]=> + int(0) + [694]=> + int(0) + [695]=> + int(0) + [696]=> + int(0) + [697]=> + int(0) + [698]=> + int(0) + [699]=> + int(0) + [700]=> + int(0) + [701]=> + int(0) + [702]=> + int(0) + [703]=> + int(0) + [704]=> + int(0) + [705]=> + int(0) + [706]=> + int(0) + [707]=> + int(0) + [708]=> + int(0) + [709]=> + int(0) + [710]=> + int(0) + [711]=> + int(0) + [712]=> + int(0) + [713]=> + int(0) + [714]=> + int(0) + [715]=> + int(0) + [716]=> + int(0) + [717]=> + int(0) + [718]=> + int(0) + [719]=> + int(0) + [720]=> + int(0) + [721]=> + int(0) + [722]=> + int(0) + [723]=> + int(0) + [724]=> + int(0) + [725]=> + int(0) + [726]=> + int(0) + [727]=> + int(0) + [728]=> + int(0) + [729]=> + int(0) + [730]=> + int(0) + [731]=> + int(0) + [732]=> + int(0) + [733]=> + int(0) + [734]=> + int(0) + [735]=> + int(0) + [736]=> + int(0) + [737]=> + int(0) + [738]=> + int(0) + [739]=> + int(0) + [740]=> + int(0) + [741]=> + int(0) + [742]=> + int(0) + [743]=> + int(0) + [744]=> + int(0) + [745]=> + int(0) + [746]=> + int(0) + [747]=> + int(0) + [748]=> + int(0) + [749]=> + int(0) + [750]=> + int(0) + [751]=> + int(0) + [752]=> + int(0) + [753]=> + int(0) + [754]=> + int(0) + [755]=> + int(0) + [756]=> + int(0) + [757]=> + int(0) + [758]=> + int(0) + [759]=> + int(0) + [760]=> + int(0) + [761]=> + int(0) + [762]=> + int(0) + [763]=> + int(0) + [764]=> + int(0) + [765]=> + int(0) + [766]=> + int(0) + [767]=> + int(0) + } + ["Copyright"]=> + string(12) "Eric Stewart" + ["GPSVersion"]=> + string(4) " + ["GPSLatitudeRef"]=> + string(1) "N" + ["GPSLatitude"]=> + array(3) { + [0]=> + string(4) "33/1" + [1]=> + string(4) "37/1" + [2]=> + string(3) "0/1" + } + ["GPSLongitudeRef"]=> + string(1) "W" + ["GPSLongitude"]=> + array(3) { + [0]=> + string(4) "84/1" + [1]=> + string(3) "7/1" + [2]=> + string(3) "0/1" + } + ["GPSAltitudeRef"]=> + string(1) " + ["GPSAltitude"]=> + string(5) "295/1" + ["GPSTimeStamp"]=> + array(3) { + [0]=> + string(3) "1/1" + [1]=> + string(4) "47/1" + [2]=> + string(4) "53/1" + } +} +--CREDIT-- +Eric Stewart <ericleestewart@gmail.com> diff --git a/ext/exif/tests/exif022.phpt b/ext/exif/tests/exif022.phpt new file mode 100644 index 0000000..f523d88 --- /dev/null +++ b/ext/exif/tests/exif022.phpt @@ -0,0 +1,1683 @@ +--TEST-- +Check for exif_read_data, TIFF with IFD, EXIF and GPS data in Intel byte-order. +--SKIPIF-- +<?php if (!extension_loaded('exif')) print 'skip exif extension not available';?> +--INI-- +output_handler= +zlib.output_compression=0 +--FILE-- +<?php +var_dump(exif_read_data(dirname(__FILE__).'/image022.tiff')); +?> +--EXPECTF-- +array(45) { + ["FileName"]=> + string(13) "image022.tiff" + ["FileDateTime"]=> + int(%d) + ["FileSize"]=> + int(%d) + ["FileType"]=> + int(7) + ["MimeType"]=> + string(10) "image/tiff" + ["SectionsFound"]=> + string(24) "ANY_TAG, IFD0, EXIF, GPS" + ["COMPUTED"]=> + array(9) { + ["html"]=> + string(20) "width="1" height="1"" + ["Height"]=> + int(1) + ["Width"]=> + int(1) + ["IsColor"]=> + int(1) + ["ByteOrderMotorola"]=> + int(0) + ["ApertureFNumber"]=> + string(5) "f/8.0" + ["Copyright"]=> + string(24) "Eric Stewart, Hex Editor" + ["Copyright.Photographer"]=> + string(12) "Eric Stewart" + ["Copyright.Editor"]=> + string(10) "Hex Editor" + } + ["ImageWidth"]=> + int(1) + ["ImageLength"]=> + int(1) + ["BitsPerSample"]=> + int(8) + ["Compression"]=> + int(5) + ["PhotometricInterpretation"]=> + int(3) + ["ImageDescription"]=> + string(15) "My description." + ["Make"]=> + string(11) "OpenShutter" + ["Model"]=> + string(8) "OS 1.0.0" + ["StripOffsets"]=> + int(2278) + ["SamplesPerPixel"]=> + int(1) + ["RowsPerStrip"]=> + int(8) + ["StripByteCounts"]=> + int(4) + ["XResolution"]=> + string(17) "381681664/2097152" + ["YResolution"]=> + string(17) "381681664/2097152" + ["PlanarConfiguration"]=> + int(1) + ["ResolutionUnit"]=> + int(2) + ["Artist"]=> + string(12) "Eric Stewart" + ["ColorMap"]=> + array(768) { + [0]=> + int(0) + [1]=> + int(65280) + [2]=> + int(32512) + [3]=> + int(49152) + [4]=> + int(99) + [5]=> + int(115) + [6]=> + int(116) + [7]=> + int(101) + [8]=> + int(119) + [9]=> + int(97) + [10]=> + int(114) + [11]=> + int(116) + [12]=> + int(0) + [13]=> + int(0) + [14]=> + int(0) + [15]=> + int(0) + [16]=> + int(0) + [17]=> + int(0) + [18]=> + int(0) + [19]=> + int(0) + [20]=> + int(0) + [21]=> + int(0) + [22]=> + int(0) + [23]=> + int(0) + [24]=> + int(0) + [25]=> + int(0) + [26]=> + int(0) + [27]=> + int(0) + [28]=> + int(0) + [29]=> + int(0) + [30]=> + int(0) + [31]=> + int(0) + [32]=> + int(0) + [33]=> + int(0) + [34]=> + int(0) + [35]=> + int(0) + [36]=> + int(0) + [37]=> + int(0) + [38]=> + int(0) + [39]=> + int(0) + [40]=> + int(0) + [41]=> + int(0) + [42]=> + int(0) + [43]=> + int(0) + [44]=> + int(0) + [45]=> + int(0) + [46]=> + int(0) + [47]=> + int(0) + [48]=> + int(0) + [49]=> + int(0) + [50]=> + int(0) + [51]=> + int(0) + [52]=> + int(0) + [53]=> + int(0) + [54]=> + int(0) + [55]=> + int(0) + [56]=> + int(0) + [57]=> + int(0) + [58]=> + int(0) + [59]=> + int(0) + [60]=> + int(0) + [61]=> + int(0) + [62]=> + int(0) + [63]=> + int(0) + [64]=> + int(0) + [65]=> + int(0) + [66]=> + int(0) + [67]=> + int(0) + [68]=> + int(0) + [69]=> + int(0) + [70]=> + int(0) + [71]=> + int(0) + [72]=> + int(0) + [73]=> + int(0) + [74]=> + int(0) + [75]=> + int(0) + [76]=> + int(0) + [77]=> + int(0) + [78]=> + int(0) + [79]=> + int(0) + [80]=> + int(0) + [81]=> + int(0) + [82]=> + int(0) + [83]=> + int(0) + [84]=> + int(0) + [85]=> + int(0) + [86]=> + int(0) + [87]=> + int(0) + [88]=> + int(0) + [89]=> + int(0) + [90]=> + int(0) + [91]=> + int(0) + [92]=> + int(0) + [93]=> + int(0) + [94]=> + int(0) + [95]=> + int(0) + [96]=> + int(0) + [97]=> + int(0) + [98]=> + int(0) + [99]=> + int(0) + [100]=> + int(0) + [101]=> + int(0) + [102]=> + int(0) + [103]=> + int(0) + [104]=> + int(0) + [105]=> + int(0) + [106]=> + int(0) + [107]=> + int(0) + [108]=> + int(0) + [109]=> + int(0) + [110]=> + int(0) + [111]=> + int(0) + [112]=> + int(0) + [113]=> + int(0) + [114]=> + int(0) + [115]=> + int(0) + [116]=> + int(0) + [117]=> + int(0) + [118]=> + int(0) + [119]=> + int(0) + [120]=> + int(0) + [121]=> + int(0) + [122]=> + int(0) + [123]=> + int(0) + [124]=> + int(0) + [125]=> + int(0) + [126]=> + int(0) + [127]=> + int(0) + [128]=> + int(0) + [129]=> + int(0) + [130]=> + int(0) + [131]=> + int(0) + [132]=> + int(0) + [133]=> + int(0) + [134]=> + int(0) + [135]=> + int(0) + [136]=> + int(0) + [137]=> + int(0) + [138]=> + int(0) + [139]=> + int(0) + [140]=> + int(0) + [141]=> + int(0) + [142]=> + int(0) + [143]=> + int(0) + [144]=> + int(0) + [145]=> + int(0) + [146]=> + int(0) + [147]=> + int(0) + [148]=> + int(0) + [149]=> + int(0) + [150]=> + int(0) + [151]=> + int(0) + [152]=> + int(0) + [153]=> + int(0) + [154]=> + int(0) + [155]=> + int(0) + [156]=> + int(0) + [157]=> + int(0) + [158]=> + int(0) + [159]=> + int(0) + [160]=> + int(0) + [161]=> + int(0) + [162]=> + int(0) + [163]=> + int(0) + [164]=> + int(0) + [165]=> + int(0) + [166]=> + int(0) + [167]=> + int(0) + [168]=> + int(0) + [169]=> + int(0) + [170]=> + int(0) + [171]=> + int(0) + [172]=> + int(0) + [173]=> + int(0) + [174]=> + int(0) + [175]=> + int(0) + [176]=> + int(0) + [177]=> + int(0) + [178]=> + int(0) + [179]=> + int(0) + [180]=> + int(0) + [181]=> + int(0) + [182]=> + int(0) + [183]=> + int(0) + [184]=> + int(0) + [185]=> + int(0) + [186]=> + int(0) + [187]=> + int(0) + [188]=> + int(0) + [189]=> + int(0) + [190]=> + int(0) + [191]=> + int(0) + [192]=> + int(0) + [193]=> + int(0) + [194]=> + int(0) + [195]=> + int(0) + [196]=> + int(0) + [197]=> + int(0) + [198]=> + int(0) + [199]=> + int(0) + [200]=> + int(0) + [201]=> + int(0) + [202]=> + int(0) + [203]=> + int(0) + [204]=> + int(0) + [205]=> + int(0) + [206]=> + int(0) + [207]=> + int(0) + [208]=> + int(0) + [209]=> + int(0) + [210]=> + int(0) + [211]=> + int(0) + [212]=> + int(0) + [213]=> + int(0) + [214]=> + int(0) + [215]=> + int(0) + [216]=> + int(0) + [217]=> + int(0) + [218]=> + int(0) + [219]=> + int(0) + [220]=> + int(0) + [221]=> + int(0) + [222]=> + int(0) + [223]=> + int(0) + [224]=> + int(0) + [225]=> + int(0) + [226]=> + int(0) + [227]=> + int(0) + [228]=> + int(0) + [229]=> + int(0) + [230]=> + int(0) + [231]=> + int(0) + [232]=> + int(0) + [233]=> + int(0) + [234]=> + int(0) + [235]=> + int(0) + [236]=> + int(0) + [237]=> + int(0) + [238]=> + int(0) + [239]=> + int(0) + [240]=> + int(0) + [241]=> + int(0) + [242]=> + int(0) + [243]=> + int(0) + [244]=> + int(0) + [245]=> + int(0) + [246]=> + int(0) + [247]=> + int(0) + [248]=> + int(0) + [249]=> + int(0) + [250]=> + int(0) + [251]=> + int(0) + [252]=> + int(0) + [253]=> + int(0) + [254]=> + int(0) + [255]=> + int(1) + [256]=> + int(0) + [257]=> + int(65280) + [258]=> + int(32512) + [259]=> + int(49152) + [260]=> + int(0) + [261]=> + int(0) + [262]=> + int(0) + [263]=> + int(0) + [264]=> + int(0) + [265]=> + int(0) + [266]=> + int(0) + [267]=> + int(0) + [268]=> + int(0) + [269]=> + int(0) + [270]=> + int(0) + [271]=> + int(0) + [272]=> + int(11945) + [273]=> + int(1914) + [274]=> + int(0) + [275]=> + int(24609) + [276]=> + int(1088) + [277]=> + int(960) + [278]=> + int(0) + [279]=> + int(0) + [280]=> + int(20000) + [281]=> + int(8414) + [282]=> + int(65436) + [283]=> + int(0) + [284]=> + int(47655) + [285]=> + int(8) + [286]=> + int(37936) + [287]=> + int(8406) + [288]=> + int(0) + [289]=> + int(0) + [290]=> + int(0) + [291]=> + int(0) + [292]=> + int(0) + [293]=> + int(0) + [294]=> + int(0) + [295]=> + int(0) + [296]=> + int(0) + [297]=> + int(64652) + [298]=> + int(50264) + [299]=> + int(0) + [300]=> + int(0) + [301]=> + int(64887) + [302]=> + int(50264) + [303]=> + int(0) + [304]=> + int(25714) + [305]=> + int(26220) + [306]=> + int(17235) + [307]=> + int(19777) + [308]=> + int(65535) + [309]=> + int(65535) + [310]=> + int(65535) + [311]=> + int(65535) + [312]=> + int(65535) + [313]=> + int(65535) + [314]=> + int(65535) + [315]=> + int(65535) + [316]=> + int(501) + [317]=> + int(0) + [318]=> + int(20) + [319]=> + int(0) + [320]=> + int(0) + [321]=> + int(0) + [322]=> + int(16877) + [323]=> + int(0) + [324]=> + int(3) + [325]=> + int(0) + [326]=> + int(0) + [327]=> + int(0) + [328]=> + int(0) + [329]=> + int(0) + [330]=> + int(0) + [331]=> + int(0) + [332]=> + int(65535) + [333]=> + int(65535) + [334]=> + int(65535) + [335]=> + int(65535) + [336]=> + int(65535) + [337]=> + int(65535) + [338]=> + int(65535) + [339]=> + int(65535) + [340]=> + int(0) + [341]=> + int(0) + [342]=> + int(52840) + [343]=> + int(2025) + [344]=> + int(16) + [345]=> + int(57377) + [346]=> + int(1024) + [347]=> + int(960) + [348]=> + int(0) + [349]=> + int(0) + [350]=> + int(27136) + [351]=> + int(8414) + [352]=> + int(65436) + [353]=> + int(0) + [354]=> + int(47655) + [355]=> + int(8) + [356]=> + int(62400) + [357]=> + int(8407) + [358]=> + int(0) + [359]=> + int(0) + [360]=> + int(0) + [361]=> + int(0) + [362]=> + int(0) + [363]=> + int(0) + [364]=> + int(0) + [365]=> + int(0) + [366]=> + int(0) + [367]=> + int(64857) + [368]=> + int(50264) + [369]=> + int(0) + [370]=> + int(0) + [371]=> + int(64892) + [372]=> + int(50264) + [373]=> + int(0) + [374]=> + int(25714) + [375]=> + int(26220) + [376]=> + int(17235) + [377]=> + int(19777) + [378]=> + int(65535) + [379]=> + int(65535) + [380]=> + int(65535) + [381]=> + int(65535) + [382]=> + int(65535) + [383]=> + int(65535) + [384]=> + int(65535) + [385]=> + int(65535) + [386]=> + int(501) + [387]=> + int(0) + [388]=> + int(20) + [389]=> + int(0) + [390]=> + int(0) + [391]=> + int(0) + [392]=> + int(16877) + [393]=> + int(0) + [394]=> + int(3) + [395]=> + int(0) + [396]=> + int(0) + [397]=> + int(0) + [398]=> + int(0) + [399]=> + int(0) + [400]=> + int(0) + [401]=> + int(0) + [402]=> + int(65535) + [403]=> + int(65535) + [404]=> + int(65535) + [405]=> + int(65535) + [406]=> + int(65535) + [407]=> + int(65535) + [408]=> + int(65535) + [409]=> + int(65535) + [410]=> + int(0) + [411]=> + int(0) + [412]=> + int(53440) + [413]=> + int(2025) + [414]=> + int(16) + [415]=> + int(57377) + [416]=> + int(1024) + [417]=> + int(960) + [418]=> + int(0) + [419]=> + int(0) + [420]=> + int(41120) + [421]=> + int(9024) + [422]=> + int(65436) + [423]=> + int(0) + [424]=> + int(47655) + [425]=> + int(8) + [426]=> + int(24480) + [427]=> + int(8404) + [428]=> + int(0) + [429]=> + int(0) + [430]=> + int(0) + [431]=> + int(0) + [432]=> + int(0) + [433]=> + int(0) + [434]=> + int(0) + [435]=> + int(0) + [436]=> + int(0) + [437]=> + int(21315) + [438]=> + int(50294) + [439]=> + int(0) + [440]=> + int(0) + [441]=> + int(53635) + [442]=> + int(50294) + [443]=> + int(0) + [444]=> + int(25714) + [445]=> + int(26220) + [446]=> + int(17235) + [447]=> + int(19777) + [448]=> + int(65535) + [449]=> + int(65535) + [450]=> + int(65535) + [451]=> + int(65535) + [452]=> + int(65535) + [453]=> + int(65535) + [454]=> + int(65535) + [455]=> + int(65535) + [456]=> + int(501) + [457]=> + int(0) + [458]=> + int(20) + [459]=> + int(0) + [460]=> + int(0) + [461]=> + int(0) + [462]=> + int(16877) + [463]=> + int(0) + [464]=> + int(3) + [465]=> + int(0) + [466]=> + int(0) + [467]=> + int(0) + [468]=> + int(0) + [469]=> + int(0) + [470]=> + int(0) + [471]=> + int(0) + [472]=> + int(65535) + [473]=> + int(65535) + [474]=> + int(65535) + [475]=> + int(65535) + [476]=> + int(65535) + [477]=> + int(65535) + [478]=> + int(65535) + [479]=> + int(65535) + [480]=> + int(0) + [481]=> + int(0) + [482]=> + int(54028) + [483]=> + int(2772) + [484]=> + int(16) + [485]=> + int(57377) + [486]=> + int(1024) + [487]=> + int(960) + [488]=> + int(0) + [489]=> + int(0) + [490]=> + int(42384) + [491]=> + int(8408) + [492]=> + int(65436) + [493]=> + int(0) + [494]=> + int(47655) + [495]=> + int(8) + [496]=> + int(1136) + [497]=> + int(8348) + [498]=> + int(0) + [499]=> + int(0) + [500]=> + int(0) + [501]=> + int(0) + [502]=> + int(0) + [503]=> + int(0) + [504]=> + int(0) + [505]=> + int(0) + [506]=> + int(0) + [507]=> + int(12326) + [508]=> + int(50261) + [509]=> + int(0) + [510]=> + int(0) + [511]=> + int(12326) + [512]=> + int(0) + [513]=> + int(65280) + [514]=> + int(32512) + [515]=> + int(49152) + [516]=> + int(0) + [517]=> + int(0) + [518]=> + int(22663) + [519]=> + int(2) + [520]=> + int(0) + [521]=> + int(0) + [522]=> + int(24576) + [523]=> + int(2) + [524]=> + int(0) + [525]=> + int(0) + [526]=> + int(501) + [527]=> + int(0) + [528]=> + int(20) + [529]=> + int(0) + [530]=> + int(0) + [531]=> + int(0) + [532]=> + int(33188) + [533]=> + int(0) + [534]=> + int(0) + [535]=> + int(0) + [536]=> + int(0) + [537]=> + int(0) + [538]=> + int(0) + [539]=> + int(0) + [540]=> + int(0) + [541]=> + int(0) + [542]=> + int(0) + [543]=> + int(0) + [544]=> + int(0) + [545]=> + int(0) + [546]=> + int(0) + [547]=> + int(0) + [548]=> + int(0) + [549]=> + int(0) + [550]=> + int(0) + [551]=> + int(0) + [552]=> + int(51766) + [553]=> + int(1946) + [554]=> + int(0) + [555]=> + int(24609) + [556]=> + int(1088) + [557]=> + int(960) + [558]=> + int(0) + [559]=> + int(0) + [560]=> + int(0) + [561]=> + int(0) + [562]=> + int(25116) + [563]=> + int(2012) + [564]=> + int(0) + [565]=> + int(0) + [566]=> + int(0) + [567]=> + int(0) + [568]=> + int(0) + [569]=> + int(0) + [570]=> + int(0) + [571]=> + int(0) + [572]=> + int(0) + [573]=> + int(0) + [574]=> + int(0) + [575]=> + int(0) + [576]=> + int(0) + [577]=> + int(0) + [578]=> + int(0) + [579]=> + int(0) + [580]=> + int(0) + [581]=> + int(0) + [582]=> + int(0) + [583]=> + int(0) + [584]=> + int(0) + [585]=> + int(0) + [586]=> + int(0) + [587]=> + int(0) + [588]=> + int(0) + [589]=> + int(0) + [590]=> + int(0) + [591]=> + int(0) + [592]=> + int(0) + [593]=> + int(0) + [594]=> + int(0) + [595]=> + int(0) + [596]=> + int(0) + [597]=> + int(0) + [598]=> + int(0) + [599]=> + int(0) + [600]=> + int(0) + [601]=> + int(0) + [602]=> + int(0) + [603]=> + int(0) + [604]=> + int(0) + [605]=> + int(0) + [606]=> + int(0) + [607]=> + int(0) + [608]=> + int(0) + [609]=> + int(0) + [610]=> + int(0) + [611]=> + int(0) + [612]=> + int(0) + [613]=> + int(0) + [614]=> + int(0) + [615]=> + int(0) + [616]=> + int(0) + [617]=> + int(0) + [618]=> + int(0) + [619]=> + int(0) + [620]=> + int(0) + [621]=> + int(0) + [622]=> + int(0) + [623]=> + int(0) + [624]=> + int(0) + [625]=> + int(0) + [626]=> + int(0) + [627]=> + int(0) + [628]=> + int(0) + [629]=> + int(0) + [630]=> + int(0) + [631]=> + int(0) + [632]=> + int(0) + [633]=> + int(0) + [634]=> + int(0) + [635]=> + int(0) + [636]=> + int(0) + [637]=> + int(0) + [638]=> + int(0) + [639]=> + int(0) + [640]=> + int(0) + [641]=> + int(0) + [642]=> + int(0) + [643]=> + int(0) + [644]=> + int(0) + [645]=> + int(0) + [646]=> + int(0) + [647]=> + int(0) + [648]=> + int(0) + [649]=> + int(0) + [650]=> + int(0) + [651]=> + int(0) + [652]=> + int(0) + [653]=> + int(0) + [654]=> + int(0) + [655]=> + int(0) + [656]=> + int(0) + [657]=> + int(0) + [658]=> + int(0) + [659]=> + int(0) + [660]=> + int(0) + [661]=> + int(0) + [662]=> + int(0) + [663]=> + int(0) + [664]=> + int(0) + [665]=> + int(0) + [666]=> + int(0) + [667]=> + int(0) + [668]=> + int(0) + [669]=> + int(0) + [670]=> + int(0) + [671]=> + int(0) + [672]=> + int(0) + [673]=> + int(0) + [674]=> + int(0) + [675]=> + int(0) + [676]=> + int(0) + [677]=> + int(0) + [678]=> + int(0) + [679]=> + int(0) + [680]=> + int(0) + [681]=> + int(0) + [682]=> + int(0) + [683]=> + int(0) + [684]=> + int(0) + [685]=> + int(0) + [686]=> + int(0) + [687]=> + int(0) + [688]=> + int(0) + [689]=> + int(0) + [690]=> + int(0) + [691]=> + int(0) + [692]=> + int(0) + [693]=> + int(0) + [694]=> + int(0) + [695]=> + int(0) + [696]=> + int(0) + [697]=> + int(0) + [698]=> + int(0) + [699]=> + int(0) + [700]=> + int(0) + [701]=> + int(0) + [702]=> + int(0) + [703]=> + int(0) + [704]=> + int(0) + [705]=> + int(0) + [706]=> + int(0) + [707]=> + int(0) + [708]=> + int(0) + [709]=> + int(0) + [710]=> + int(0) + [711]=> + int(0) + [712]=> + int(0) + [713]=> + int(0) + [714]=> + int(0) + [715]=> + int(0) + [716]=> + int(0) + [717]=> + int(0) + [718]=> + int(0) + [719]=> + int(0) + [720]=> + int(0) + [721]=> + int(0) + [722]=> + int(0) + [723]=> + int(0) + [724]=> + int(0) + [725]=> + int(0) + [726]=> + int(0) + [727]=> + int(0) + [728]=> + int(0) + [729]=> + int(0) + [730]=> + int(0) + [731]=> + int(0) + [732]=> + int(0) + [733]=> + int(0) + [734]=> + int(0) + [735]=> + int(0) + [736]=> + int(0) + [737]=> + int(0) + [738]=> + int(0) + [739]=> + int(0) + [740]=> + int(0) + [741]=> + int(0) + [742]=> + int(0) + [743]=> + int(0) + [744]=> + int(0) + [745]=> + int(0) + [746]=> + int(0) + [747]=> + int(0) + [748]=> + int(0) + [749]=> + int(0) + [750]=> + int(0) + [751]=> + int(0) + [752]=> + int(0) + [753]=> + int(0) + [754]=> + int(0) + [755]=> + int(0) + [756]=> + int(0) + [757]=> + int(0) + [758]=> + int(0) + [759]=> + int(0) + [760]=> + int(0) + [761]=> + int(0) + [762]=> + int(0) + [763]=> + int(0) + [764]=> + int(0) + [765]=> + int(0) + [766]=> + int(0) + [767]=> + int(0) + } + ["Copyright"]=> + string(12) "Eric Stewart" + ["ExposureTime"]=> + string(5) "1/125" + ["FNumber"]=> + string(3) "8/1" + ["ISOSpeedRatings"]=> + int(80) + ["DateTimeOriginal"]=> + string(19) "2008:06:19 01:47:53" + ["DateTimeDigitized"]=> + string(19) "2008:06:19 01:47:53" + ["MeteringMode"]=> + int(5) + ["LightSource"]=> + int(4) + ["Flash"]=> + int(7) + ["FocalLength"]=> + string(4) "29/5" + ["ExifImageWidth"]=> + int(1) + ["ExifImageLength"]=> + int(1) + ["GPSVersion"]=> + string(4) " + ["GPSLatitudeRef"]=> + string(1) "N" + ["GPSLatitude"]=> + array(3) { + [0]=> + string(4) "33/1" + [1]=> + string(4) "37/1" + [2]=> + string(3) "0/1" + } + ["GPSLongitudeRef"]=> + string(1) "W" + ["GPSLongitude"]=> + array(3) { + [0]=> + string(4) "84/1" + [1]=> + string(3) "7/1" + [2]=> + string(3) "0/1" + } + ["GPSAltitudeRef"]=> + string(1) " + ["GPSAltitude"]=> + string(5) "295/1" + ["GPSTimeStamp"]=> + array(3) { + [0]=> + string(3) "1/1" + [1]=> + string(4) "47/1" + [2]=> + string(4) "53/1" + } +} +--CREDIT-- +Eric Stewart <ericleestewart@gmail.com> diff --git a/ext/exif/tests/exif023.phpt b/ext/exif/tests/exif023.phpt new file mode 100644 index 0000000..5940d97 --- /dev/null +++ b/ext/exif/tests/exif023.phpt @@ -0,0 +1,1683 @@ +--TEST-- +Check for exif_read_data, TIFF with IFD, EXIF and GPS data in Motorola byte-order. +--SKIPIF-- +<?php if (!extension_loaded('exif')) print 'skip exif extension not available';?> +--INI-- +output_handler= +zlib.output_compression=0 +--FILE-- +<?php +var_dump(exif_read_data(dirname(__FILE__).'/image023.tiff')); +?> +--EXPECTF-- +array(45) { + ["FileName"]=> + string(13) "image023.tiff" + ["FileDateTime"]=> + int(%d) + ["FileSize"]=> + int(%d) + ["FileType"]=> + int(8) + ["MimeType"]=> + string(10) "image/tiff" + ["SectionsFound"]=> + string(24) "ANY_TAG, IFD0, EXIF, GPS" + ["COMPUTED"]=> + array(9) { + ["html"]=> + string(20) "width="1" height="1"" + ["Height"]=> + int(1) + ["Width"]=> + int(1) + ["IsColor"]=> + int(1) + ["ByteOrderMotorola"]=> + int(1) + ["ApertureFNumber"]=> + string(5) "f/8.0" + ["Copyright"]=> + string(24) "Eric Stewart, Hex Editor" + ["Copyright.Photographer"]=> + string(12) "Eric Stewart" + ["Copyright.Editor"]=> + string(10) "Hex Editor" + } + ["ImageWidth"]=> + int(1) + ["ImageLength"]=> + int(1) + ["BitsPerSample"]=> + int(8) + ["Compression"]=> + int(5) + ["PhotometricInterpretation"]=> + int(3) + ["ImageDescription"]=> + string(15) "My description." + ["Make"]=> + string(11) "OpenShutter" + ["Model"]=> + string(8) "OS 1.0.0" + ["StripOffsets"]=> + int(2278) + ["SamplesPerPixel"]=> + int(1) + ["RowsPerStrip"]=> + int(8) + ["StripByteCounts"]=> + int(4) + ["XResolution"]=> + string(17) "381681664/2097152" + ["YResolution"]=> + string(17) "381681664/2097152" + ["PlanarConfiguration"]=> + int(1) + ["ResolutionUnit"]=> + int(2) + ["Artist"]=> + string(12) "Eric Stewart" + ["ColorMap"]=> + array(768) { + [0]=> + int(0) + [1]=> + int(65280) + [2]=> + int(32512) + [3]=> + int(49152) + [4]=> + int(99) + [5]=> + int(115) + [6]=> + int(116) + [7]=> + int(101) + [8]=> + int(119) + [9]=> + int(97) + [10]=> + int(114) + [11]=> + int(116) + [12]=> + int(0) + [13]=> + int(0) + [14]=> + int(0) + [15]=> + int(0) + [16]=> + int(0) + [17]=> + int(0) + [18]=> + int(0) + [19]=> + int(0) + [20]=> + int(0) + [21]=> + int(0) + [22]=> + int(0) + [23]=> + int(0) + [24]=> + int(0) + [25]=> + int(0) + [26]=> + int(0) + [27]=> + int(0) + [28]=> + int(0) + [29]=> + int(0) + [30]=> + int(0) + [31]=> + int(0) + [32]=> + int(0) + [33]=> + int(0) + [34]=> + int(0) + [35]=> + int(0) + [36]=> + int(0) + [37]=> + int(0) + [38]=> + int(0) + [39]=> + int(0) + [40]=> + int(0) + [41]=> + int(0) + [42]=> + int(0) + [43]=> + int(0) + [44]=> + int(0) + [45]=> + int(0) + [46]=> + int(0) + [47]=> + int(0) + [48]=> + int(0) + [49]=> + int(0) + [50]=> + int(0) + [51]=> + int(0) + [52]=> + int(0) + [53]=> + int(0) + [54]=> + int(0) + [55]=> + int(0) + [56]=> + int(0) + [57]=> + int(0) + [58]=> + int(0) + [59]=> + int(0) + [60]=> + int(0) + [61]=> + int(0) + [62]=> + int(0) + [63]=> + int(0) + [64]=> + int(0) + [65]=> + int(0) + [66]=> + int(0) + [67]=> + int(0) + [68]=> + int(0) + [69]=> + int(0) + [70]=> + int(0) + [71]=> + int(0) + [72]=> + int(0) + [73]=> + int(0) + [74]=> + int(0) + [75]=> + int(0) + [76]=> + int(0) + [77]=> + int(0) + [78]=> + int(0) + [79]=> + int(0) + [80]=> + int(0) + [81]=> + int(0) + [82]=> + int(0) + [83]=> + int(0) + [84]=> + int(0) + [85]=> + int(0) + [86]=> + int(0) + [87]=> + int(0) + [88]=> + int(0) + [89]=> + int(0) + [90]=> + int(0) + [91]=> + int(0) + [92]=> + int(0) + [93]=> + int(0) + [94]=> + int(0) + [95]=> + int(0) + [96]=> + int(0) + [97]=> + int(0) + [98]=> + int(0) + [99]=> + int(0) + [100]=> + int(0) + [101]=> + int(0) + [102]=> + int(0) + [103]=> + int(0) + [104]=> + int(0) + [105]=> + int(0) + [106]=> + int(0) + [107]=> + int(0) + [108]=> + int(0) + [109]=> + int(0) + [110]=> + int(0) + [111]=> + int(0) + [112]=> + int(0) + [113]=> + int(0) + [114]=> + int(0) + [115]=> + int(0) + [116]=> + int(0) + [117]=> + int(0) + [118]=> + int(0) + [119]=> + int(0) + [120]=> + int(0) + [121]=> + int(0) + [122]=> + int(0) + [123]=> + int(0) + [124]=> + int(0) + [125]=> + int(0) + [126]=> + int(0) + [127]=> + int(0) + [128]=> + int(0) + [129]=> + int(0) + [130]=> + int(0) + [131]=> + int(0) + [132]=> + int(0) + [133]=> + int(0) + [134]=> + int(0) + [135]=> + int(0) + [136]=> + int(0) + [137]=> + int(0) + [138]=> + int(0) + [139]=> + int(0) + [140]=> + int(0) + [141]=> + int(0) + [142]=> + int(0) + [143]=> + int(0) + [144]=> + int(0) + [145]=> + int(0) + [146]=> + int(0) + [147]=> + int(0) + [148]=> + int(0) + [149]=> + int(0) + [150]=> + int(0) + [151]=> + int(0) + [152]=> + int(0) + [153]=> + int(0) + [154]=> + int(0) + [155]=> + int(0) + [156]=> + int(0) + [157]=> + int(0) + [158]=> + int(0) + [159]=> + int(0) + [160]=> + int(0) + [161]=> + int(0) + [162]=> + int(0) + [163]=> + int(0) + [164]=> + int(0) + [165]=> + int(0) + [166]=> + int(0) + [167]=> + int(0) + [168]=> + int(0) + [169]=> + int(0) + [170]=> + int(0) + [171]=> + int(0) + [172]=> + int(0) + [173]=> + int(0) + [174]=> + int(0) + [175]=> + int(0) + [176]=> + int(0) + [177]=> + int(0) + [178]=> + int(0) + [179]=> + int(0) + [180]=> + int(0) + [181]=> + int(0) + [182]=> + int(0) + [183]=> + int(0) + [184]=> + int(0) + [185]=> + int(0) + [186]=> + int(0) + [187]=> + int(0) + [188]=> + int(0) + [189]=> + int(0) + [190]=> + int(0) + [191]=> + int(0) + [192]=> + int(0) + [193]=> + int(0) + [194]=> + int(0) + [195]=> + int(0) + [196]=> + int(0) + [197]=> + int(0) + [198]=> + int(0) + [199]=> + int(0) + [200]=> + int(0) + [201]=> + int(0) + [202]=> + int(0) + [203]=> + int(0) + [204]=> + int(0) + [205]=> + int(0) + [206]=> + int(0) + [207]=> + int(0) + [208]=> + int(0) + [209]=> + int(0) + [210]=> + int(0) + [211]=> + int(0) + [212]=> + int(0) + [213]=> + int(0) + [214]=> + int(0) + [215]=> + int(0) + [216]=> + int(0) + [217]=> + int(0) + [218]=> + int(0) + [219]=> + int(0) + [220]=> + int(0) + [221]=> + int(0) + [222]=> + int(0) + [223]=> + int(0) + [224]=> + int(0) + [225]=> + int(0) + [226]=> + int(0) + [227]=> + int(0) + [228]=> + int(0) + [229]=> + int(0) + [230]=> + int(0) + [231]=> + int(0) + [232]=> + int(0) + [233]=> + int(0) + [234]=> + int(0) + [235]=> + int(0) + [236]=> + int(0) + [237]=> + int(0) + [238]=> + int(0) + [239]=> + int(0) + [240]=> + int(0) + [241]=> + int(0) + [242]=> + int(0) + [243]=> + int(0) + [244]=> + int(0) + [245]=> + int(0) + [246]=> + int(0) + [247]=> + int(0) + [248]=> + int(0) + [249]=> + int(0) + [250]=> + int(0) + [251]=> + int(0) + [252]=> + int(0) + [253]=> + int(0) + [254]=> + int(0) + [255]=> + int(1) + [256]=> + int(0) + [257]=> + int(65280) + [258]=> + int(32512) + [259]=> + int(49152) + [260]=> + int(0) + [261]=> + int(0) + [262]=> + int(0) + [263]=> + int(0) + [264]=> + int(0) + [265]=> + int(0) + [266]=> + int(0) + [267]=> + int(0) + [268]=> + int(0) + [269]=> + int(0) + [270]=> + int(0) + [271]=> + int(0) + [272]=> + int(11945) + [273]=> + int(1914) + [274]=> + int(0) + [275]=> + int(24609) + [276]=> + int(1088) + [277]=> + int(960) + [278]=> + int(0) + [279]=> + int(0) + [280]=> + int(20000) + [281]=> + int(8414) + [282]=> + int(65436) + [283]=> + int(0) + [284]=> + int(47655) + [285]=> + int(8) + [286]=> + int(37936) + [287]=> + int(8406) + [288]=> + int(0) + [289]=> + int(0) + [290]=> + int(0) + [291]=> + int(0) + [292]=> + int(0) + [293]=> + int(0) + [294]=> + int(0) + [295]=> + int(0) + [296]=> + int(0) + [297]=> + int(64652) + [298]=> + int(50264) + [299]=> + int(0) + [300]=> + int(0) + [301]=> + int(64887) + [302]=> + int(50264) + [303]=> + int(0) + [304]=> + int(25714) + [305]=> + int(26220) + [306]=> + int(17235) + [307]=> + int(19777) + [308]=> + int(65535) + [309]=> + int(65535) + [310]=> + int(65535) + [311]=> + int(65535) + [312]=> + int(65535) + [313]=> + int(65535) + [314]=> + int(65535) + [315]=> + int(65535) + [316]=> + int(501) + [317]=> + int(0) + [318]=> + int(20) + [319]=> + int(0) + [320]=> + int(0) + [321]=> + int(0) + [322]=> + int(16877) + [323]=> + int(0) + [324]=> + int(3) + [325]=> + int(0) + [326]=> + int(0) + [327]=> + int(0) + [328]=> + int(0) + [329]=> + int(0) + [330]=> + int(0) + [331]=> + int(0) + [332]=> + int(65535) + [333]=> + int(65535) + [334]=> + int(65535) + [335]=> + int(65535) + [336]=> + int(65535) + [337]=> + int(65535) + [338]=> + int(65535) + [339]=> + int(65535) + [340]=> + int(0) + [341]=> + int(0) + [342]=> + int(52840) + [343]=> + int(2025) + [344]=> + int(16) + [345]=> + int(57377) + [346]=> + int(1024) + [347]=> + int(960) + [348]=> + int(0) + [349]=> + int(0) + [350]=> + int(27136) + [351]=> + int(8414) + [352]=> + int(65436) + [353]=> + int(0) + [354]=> + int(47655) + [355]=> + int(8) + [356]=> + int(62400) + [357]=> + int(8407) + [358]=> + int(0) + [359]=> + int(0) + [360]=> + int(0) + [361]=> + int(0) + [362]=> + int(0) + [363]=> + int(0) + [364]=> + int(0) + [365]=> + int(0) + [366]=> + int(0) + [367]=> + int(64857) + [368]=> + int(50264) + [369]=> + int(0) + [370]=> + int(0) + [371]=> + int(64892) + [372]=> + int(50264) + [373]=> + int(0) + [374]=> + int(25714) + [375]=> + int(26220) + [376]=> + int(17235) + [377]=> + int(19777) + [378]=> + int(65535) + [379]=> + int(65535) + [380]=> + int(65535) + [381]=> + int(65535) + [382]=> + int(65535) + [383]=> + int(65535) + [384]=> + int(65535) + [385]=> + int(65535) + [386]=> + int(501) + [387]=> + int(0) + [388]=> + int(20) + [389]=> + int(0) + [390]=> + int(0) + [391]=> + int(0) + [392]=> + int(16877) + [393]=> + int(0) + [394]=> + int(3) + [395]=> + int(0) + [396]=> + int(0) + [397]=> + int(0) + [398]=> + int(0) + [399]=> + int(0) + [400]=> + int(0) + [401]=> + int(0) + [402]=> + int(65535) + [403]=> + int(65535) + [404]=> + int(65535) + [405]=> + int(65535) + [406]=> + int(65535) + [407]=> + int(65535) + [408]=> + int(65535) + [409]=> + int(65535) + [410]=> + int(0) + [411]=> + int(0) + [412]=> + int(53440) + [413]=> + int(2025) + [414]=> + int(16) + [415]=> + int(57377) + [416]=> + int(1024) + [417]=> + int(960) + [418]=> + int(0) + [419]=> + int(0) + [420]=> + int(41120) + [421]=> + int(9024) + [422]=> + int(65436) + [423]=> + int(0) + [424]=> + int(47655) + [425]=> + int(8) + [426]=> + int(24480) + [427]=> + int(8404) + [428]=> + int(0) + [429]=> + int(0) + [430]=> + int(0) + [431]=> + int(0) + [432]=> + int(0) + [433]=> + int(0) + [434]=> + int(0) + [435]=> + int(0) + [436]=> + int(0) + [437]=> + int(21315) + [438]=> + int(50294) + [439]=> + int(0) + [440]=> + int(0) + [441]=> + int(53635) + [442]=> + int(50294) + [443]=> + int(0) + [444]=> + int(25714) + [445]=> + int(26220) + [446]=> + int(17235) + [447]=> + int(19777) + [448]=> + int(65535) + [449]=> + int(65535) + [450]=> + int(65535) + [451]=> + int(65535) + [452]=> + int(65535) + [453]=> + int(65535) + [454]=> + int(65535) + [455]=> + int(65535) + [456]=> + int(501) + [457]=> + int(0) + [458]=> + int(20) + [459]=> + int(0) + [460]=> + int(0) + [461]=> + int(0) + [462]=> + int(16877) + [463]=> + int(0) + [464]=> + int(3) + [465]=> + int(0) + [466]=> + int(0) + [467]=> + int(0) + [468]=> + int(0) + [469]=> + int(0) + [470]=> + int(0) + [471]=> + int(0) + [472]=> + int(65535) + [473]=> + int(65535) + [474]=> + int(65535) + [475]=> + int(65535) + [476]=> + int(65535) + [477]=> + int(65535) + [478]=> + int(65535) + [479]=> + int(65535) + [480]=> + int(0) + [481]=> + int(0) + [482]=> + int(54028) + [483]=> + int(2772) + [484]=> + int(16) + [485]=> + int(57377) + [486]=> + int(1024) + [487]=> + int(960) + [488]=> + int(0) + [489]=> + int(0) + [490]=> + int(42384) + [491]=> + int(8408) + [492]=> + int(65436) + [493]=> + int(0) + [494]=> + int(47655) + [495]=> + int(8) + [496]=> + int(1136) + [497]=> + int(8348) + [498]=> + int(0) + [499]=> + int(0) + [500]=> + int(0) + [501]=> + int(0) + [502]=> + int(0) + [503]=> + int(0) + [504]=> + int(0) + [505]=> + int(0) + [506]=> + int(0) + [507]=> + int(12326) + [508]=> + int(50261) + [509]=> + int(0) + [510]=> + int(0) + [511]=> + int(12326) + [512]=> + int(0) + [513]=> + int(65280) + [514]=> + int(32512) + [515]=> + int(49152) + [516]=> + int(0) + [517]=> + int(0) + [518]=> + int(22663) + [519]=> + int(2) + [520]=> + int(0) + [521]=> + int(0) + [522]=> + int(24576) + [523]=> + int(2) + [524]=> + int(0) + [525]=> + int(0) + [526]=> + int(501) + [527]=> + int(0) + [528]=> + int(20) + [529]=> + int(0) + [530]=> + int(0) + [531]=> + int(0) + [532]=> + int(33188) + [533]=> + int(0) + [534]=> + int(0) + [535]=> + int(0) + [536]=> + int(0) + [537]=> + int(0) + [538]=> + int(0) + [539]=> + int(0) + [540]=> + int(0) + [541]=> + int(0) + [542]=> + int(0) + [543]=> + int(0) + [544]=> + int(0) + [545]=> + int(0) + [546]=> + int(0) + [547]=> + int(0) + [548]=> + int(0) + [549]=> + int(0) + [550]=> + int(0) + [551]=> + int(0) + [552]=> + int(51766) + [553]=> + int(1946) + [554]=> + int(0) + [555]=> + int(24609) + [556]=> + int(1088) + [557]=> + int(960) + [558]=> + int(0) + [559]=> + int(0) + [560]=> + int(0) + [561]=> + int(0) + [562]=> + int(25116) + [563]=> + int(2012) + [564]=> + int(0) + [565]=> + int(0) + [566]=> + int(0) + [567]=> + int(0) + [568]=> + int(0) + [569]=> + int(0) + [570]=> + int(0) + [571]=> + int(0) + [572]=> + int(0) + [573]=> + int(0) + [574]=> + int(0) + [575]=> + int(0) + [576]=> + int(0) + [577]=> + int(0) + [578]=> + int(0) + [579]=> + int(0) + [580]=> + int(0) + [581]=> + int(0) + [582]=> + int(0) + [583]=> + int(0) + [584]=> + int(0) + [585]=> + int(0) + [586]=> + int(0) + [587]=> + int(0) + [588]=> + int(0) + [589]=> + int(0) + [590]=> + int(0) + [591]=> + int(0) + [592]=> + int(0) + [593]=> + int(0) + [594]=> + int(0) + [595]=> + int(0) + [596]=> + int(0) + [597]=> + int(0) + [598]=> + int(0) + [599]=> + int(0) + [600]=> + int(0) + [601]=> + int(0) + [602]=> + int(0) + [603]=> + int(0) + [604]=> + int(0) + [605]=> + int(0) + [606]=> + int(0) + [607]=> + int(0) + [608]=> + int(0) + [609]=> + int(0) + [610]=> + int(0) + [611]=> + int(0) + [612]=> + int(0) + [613]=> + int(0) + [614]=> + int(0) + [615]=> + int(0) + [616]=> + int(0) + [617]=> + int(0) + [618]=> + int(0) + [619]=> + int(0) + [620]=> + int(0) + [621]=> + int(0) + [622]=> + int(0) + [623]=> + int(0) + [624]=> + int(0) + [625]=> + int(0) + [626]=> + int(0) + [627]=> + int(0) + [628]=> + int(0) + [629]=> + int(0) + [630]=> + int(0) + [631]=> + int(0) + [632]=> + int(0) + [633]=> + int(0) + [634]=> + int(0) + [635]=> + int(0) + [636]=> + int(0) + [637]=> + int(0) + [638]=> + int(0) + [639]=> + int(0) + [640]=> + int(0) + [641]=> + int(0) + [642]=> + int(0) + [643]=> + int(0) + [644]=> + int(0) + [645]=> + int(0) + [646]=> + int(0) + [647]=> + int(0) + [648]=> + int(0) + [649]=> + int(0) + [650]=> + int(0) + [651]=> + int(0) + [652]=> + int(0) + [653]=> + int(0) + [654]=> + int(0) + [655]=> + int(0) + [656]=> + int(0) + [657]=> + int(0) + [658]=> + int(0) + [659]=> + int(0) + [660]=> + int(0) + [661]=> + int(0) + [662]=> + int(0) + [663]=> + int(0) + [664]=> + int(0) + [665]=> + int(0) + [666]=> + int(0) + [667]=> + int(0) + [668]=> + int(0) + [669]=> + int(0) + [670]=> + int(0) + [671]=> + int(0) + [672]=> + int(0) + [673]=> + int(0) + [674]=> + int(0) + [675]=> + int(0) + [676]=> + int(0) + [677]=> + int(0) + [678]=> + int(0) + [679]=> + int(0) + [680]=> + int(0) + [681]=> + int(0) + [682]=> + int(0) + [683]=> + int(0) + [684]=> + int(0) + [685]=> + int(0) + [686]=> + int(0) + [687]=> + int(0) + [688]=> + int(0) + [689]=> + int(0) + [690]=> + int(0) + [691]=> + int(0) + [692]=> + int(0) + [693]=> + int(0) + [694]=> + int(0) + [695]=> + int(0) + [696]=> + int(0) + [697]=> + int(0) + [698]=> + int(0) + [699]=> + int(0) + [700]=> + int(0) + [701]=> + int(0) + [702]=> + int(0) + [703]=> + int(0) + [704]=> + int(0) + [705]=> + int(0) + [706]=> + int(0) + [707]=> + int(0) + [708]=> + int(0) + [709]=> + int(0) + [710]=> + int(0) + [711]=> + int(0) + [712]=> + int(0) + [713]=> + int(0) + [714]=> + int(0) + [715]=> + int(0) + [716]=> + int(0) + [717]=> + int(0) + [718]=> + int(0) + [719]=> + int(0) + [720]=> + int(0) + [721]=> + int(0) + [722]=> + int(0) + [723]=> + int(0) + [724]=> + int(0) + [725]=> + int(0) + [726]=> + int(0) + [727]=> + int(0) + [728]=> + int(0) + [729]=> + int(0) + [730]=> + int(0) + [731]=> + int(0) + [732]=> + int(0) + [733]=> + int(0) + [734]=> + int(0) + [735]=> + int(0) + [736]=> + int(0) + [737]=> + int(0) + [738]=> + int(0) + [739]=> + int(0) + [740]=> + int(0) + [741]=> + int(0) + [742]=> + int(0) + [743]=> + int(0) + [744]=> + int(0) + [745]=> + int(0) + [746]=> + int(0) + [747]=> + int(0) + [748]=> + int(0) + [749]=> + int(0) + [750]=> + int(0) + [751]=> + int(0) + [752]=> + int(0) + [753]=> + int(0) + [754]=> + int(0) + [755]=> + int(0) + [756]=> + int(0) + [757]=> + int(0) + [758]=> + int(0) + [759]=> + int(0) + [760]=> + int(0) + [761]=> + int(0) + [762]=> + int(0) + [763]=> + int(0) + [764]=> + int(0) + [765]=> + int(0) + [766]=> + int(0) + [767]=> + int(0) + } + ["Copyright"]=> + string(12) "Eric Stewart" + ["ExposureTime"]=> + string(5) "1/125" + ["FNumber"]=> + string(3) "8/1" + ["ISOSpeedRatings"]=> + int(80) + ["DateTimeOriginal"]=> + string(19) "2008:06:19 01:47:53" + ["DateTimeDigitized"]=> + string(19) "2008:06:19 01:47:53" + ["MeteringMode"]=> + int(5) + ["LightSource"]=> + int(4) + ["Flash"]=> + int(7) + ["FocalLength"]=> + string(4) "29/5" + ["ExifImageWidth"]=> + int(1) + ["ExifImageLength"]=> + int(1) + ["GPSVersion"]=> + string(4) " + ["GPSLatitudeRef"]=> + string(1) "N" + ["GPSLatitude"]=> + array(3) { + [0]=> + string(4) "33/1" + [1]=> + string(4) "37/1" + [2]=> + string(3) "0/1" + } + ["GPSLongitudeRef"]=> + string(1) "W" + ["GPSLongitude"]=> + array(3) { + [0]=> + string(4) "84/1" + [1]=> + string(3) "7/1" + [2]=> + string(3) "0/1" + } + ["GPSAltitudeRef"]=> + string(1) " + ["GPSAltitude"]=> + string(5) "295/1" + ["GPSTimeStamp"]=> + array(3) { + [0]=> + string(3) "1/1" + [1]=> + string(4) "47/1" + [2]=> + string(4) "53/1" + } +} +--CREDIT-- +Eric Stewart <ericleestewart@gmail.com> diff --git a/ext/exif/tests/exif024.phpt b/ext/exif/tests/exif024.phpt new file mode 100644 index 0000000..4839d1c --- /dev/null +++ b/ext/exif/tests/exif024.phpt @@ -0,0 +1,55 @@ +--TEST-- +Check for exif_read_data, JPEG with IFD0, EXIF, INTEROP data in Intel byte-order. +--SKIPIF-- +<?php if (!extension_loaded('exif')) print 'skip exif extension not available';?> +--INI-- +output_handler= +zlib.output_compression=0 +--FILE-- +<?php +var_dump(exif_read_data(dirname(__FILE__).'/image024.jpg')); +?> +--EXPECTF-- +array(14) { + ["FileName"]=> + string(12) "image024.jpg" + ["FileDateTime"]=> + int(%d) + ["FileSize"]=> + int(%d) + ["FileType"]=> + int(2) + ["MimeType"]=> + string(10) "image/jpeg" + ["SectionsFound"]=> + string(28) "ANY_TAG, IFD0, EXIF, INTEROP" + ["COMPUTED"]=> + array(5) { + ["html"]=> + string(20) "width="1" height="1"" + ["Height"]=> + int(1) + ["Width"]=> + int(1) + ["IsColor"]=> + int(1) + ["ByteOrderMotorola"]=> + int(0) + } + ["Exif_IFD_Pointer"]=> + int(26) + ["InteroperabilityOffset"]=> + int(44) + ["InterOperabilityIndex"]=> + string(3) "R98" + ["InterOperabilityVersion"]=> + string(4) "0100" + ["RelatedFileFormat"]=> + string(12) "image024.jpg" + ["RelatedImageWidth"]=> + int(1) + ["RelatedImageHeight"]=> + int(1) +} +--CREDIT-- +Eric Stewart <ericleestewart@gmail.com> diff --git a/ext/exif/tests/exif025.phpt b/ext/exif/tests/exif025.phpt new file mode 100644 index 0000000..683dc7e --- /dev/null +++ b/ext/exif/tests/exif025.phpt @@ -0,0 +1,55 @@ +--TEST-- +Check for exif_read_data, JPEG with IFD0, EXIF, INTEROP data in Motorola byte-order. +--SKIPIF-- +<?php if (!extension_loaded('exif')) print 'skip exif extension not available';?> +--INI-- +output_handler= +zlib.output_compression=0 +--FILE-- +<?php +var_dump(exif_read_data(dirname(__FILE__).'/image025.jpg')); +?> +--EXPECTF-- +array(14) { + ["FileName"]=> + string(12) "image025.jpg" + ["FileDateTime"]=> + int(%d) + ["FileSize"]=> + int(%d) + ["FileType"]=> + int(2) + ["MimeType"]=> + string(10) "image/jpeg" + ["SectionsFound"]=> + string(28) "ANY_TAG, IFD0, EXIF, INTEROP" + ["COMPUTED"]=> + array(5) { + ["html"]=> + string(20) "width="1" height="1"" + ["Height"]=> + int(1) + ["Width"]=> + int(1) + ["IsColor"]=> + int(1) + ["ByteOrderMotorola"]=> + int(1) + } + ["Exif_IFD_Pointer"]=> + int(26) + ["InteroperabilityOffset"]=> + int(44) + ["InterOperabilityIndex"]=> + string(3) "R98" + ["InterOperabilityVersion"]=> + string(4) "0100" + ["RelatedFileFormat"]=> + string(12) "image025.jpg" + ["RelatedImageWidth"]=> + int(1) + ["RelatedImageHeight"]=> + int(1) +} +--CREDIT-- +Eric Stewart <ericleestewart@gmail.com> diff --git a/ext/exif/tests/exif026.phpt b/ext/exif/tests/exif026.phpt new file mode 100644 index 0000000..7de7968 --- /dev/null +++ b/ext/exif/tests/exif026.phpt @@ -0,0 +1,1632 @@ +--TEST-- +Check for exif_read_data, TIFF with IFD0, EXIF, INTEROP data in Intel byte-order. +--SKIPIF-- +<?php if (!extension_loaded('exif')) print 'skip exif extension not available';?> +--INI-- +output_handler= +zlib.output_compression=0 +--FILE-- +<?php +var_dump(exif_read_data(dirname(__FILE__).'/image026.tiff')); +?> +--EXPECTF-- +array(31) { + ["FileName"]=> + string(13) "image026.tiff" + ["FileDateTime"]=> + int(%d) + ["FileSize"]=> + int(%d) + ["FileType"]=> + int(7) + ["MimeType"]=> + string(10) "image/tiff" + ["SectionsFound"]=> + string(28) "ANY_TAG, IFD0, EXIF, INTEROP" + ["COMPUTED"]=> + array(8) { + ["html"]=> + string(20) "width="1" height="1"" + ["Height"]=> + int(1) + ["Width"]=> + int(1) + ["IsColor"]=> + int(1) + ["ByteOrderMotorola"]=> + int(0) + ["Copyright"]=> + string(24) "Eric Stewart, Hex Editor" + ["Copyright.Photographer"]=> + string(12) "Eric Stewart" + ["Copyright.Editor"]=> + string(10) "Hex Editor" + } + ["ImageWidth"]=> + int(1) + ["ImageLength"]=> + int(1) + ["BitsPerSample"]=> + int(8) + ["Compression"]=> + int(5) + ["PhotometricInterpretation"]=> + int(3) + ["ImageDescription"]=> + string(15) "My description." + ["Make"]=> + string(11) "OpenShutter" + ["Model"]=> + string(8) "OS 1.0.0" + ["StripOffsets"]=> + int(1980) + ["SamplesPerPixel"]=> + int(1) + ["RowsPerStrip"]=> + int(8) + ["StripByteCounts"]=> + int(4) + ["XResolution"]=> + string(17) "381681664/2097152" + ["YResolution"]=> + string(17) "381681664/2097152" + ["PlanarConfiguration"]=> + int(1) + ["ResolutionUnit"]=> + int(2) + ["Artist"]=> + string(12) "Eric Stewart" + ["ColorMap"]=> + array(768) { + [0]=> + int(0) + [1]=> + int(65280) + [2]=> + int(32512) + [3]=> + int(49152) + [4]=> + int(99) + [5]=> + int(115) + [6]=> + int(116) + [7]=> + int(101) + [8]=> + int(119) + [9]=> + int(97) + [10]=> + int(114) + [11]=> + int(116) + [12]=> + int(0) + [13]=> + int(0) + [14]=> + int(0) + [15]=> + int(0) + [16]=> + int(0) + [17]=> + int(0) + [18]=> + int(0) + [19]=> + int(0) + [20]=> + int(0) + [21]=> + int(0) + [22]=> + int(0) + [23]=> + int(0) + [24]=> + int(0) + [25]=> + int(0) + [26]=> + int(0) + [27]=> + int(0) + [28]=> + int(0) + [29]=> + int(0) + [30]=> + int(0) + [31]=> + int(0) + [32]=> + int(0) + [33]=> + int(0) + [34]=> + int(0) + [35]=> + int(0) + [36]=> + int(0) + [37]=> + int(0) + [38]=> + int(0) + [39]=> + int(0) + [40]=> + int(0) + [41]=> + int(0) + [42]=> + int(0) + [43]=> + int(0) + [44]=> + int(0) + [45]=> + int(0) + [46]=> + int(0) + [47]=> + int(0) + [48]=> + int(0) + [49]=> + int(0) + [50]=> + int(0) + [51]=> + int(0) + [52]=> + int(0) + [53]=> + int(0) + [54]=> + int(0) + [55]=> + int(0) + [56]=> + int(0) + [57]=> + int(0) + [58]=> + int(0) + [59]=> + int(0) + [60]=> + int(0) + [61]=> + int(0) + [62]=> + int(0) + [63]=> + int(0) + [64]=> + int(0) + [65]=> + int(0) + [66]=> + int(0) + [67]=> + int(0) + [68]=> + int(0) + [69]=> + int(0) + [70]=> + int(0) + [71]=> + int(0) + [72]=> + int(0) + [73]=> + int(0) + [74]=> + int(0) + [75]=> + int(0) + [76]=> + int(0) + [77]=> + int(0) + [78]=> + int(0) + [79]=> + int(0) + [80]=> + int(0) + [81]=> + int(0) + [82]=> + int(0) + [83]=> + int(0) + [84]=> + int(0) + [85]=> + int(0) + [86]=> + int(0) + [87]=> + int(0) + [88]=> + int(0) + [89]=> + int(0) + [90]=> + int(0) + [91]=> + int(0) + [92]=> + int(0) + [93]=> + int(0) + [94]=> + int(0) + [95]=> + int(0) + [96]=> + int(0) + [97]=> + int(0) + [98]=> + int(0) + [99]=> + int(0) + [100]=> + int(0) + [101]=> + int(0) + [102]=> + int(0) + [103]=> + int(0) + [104]=> + int(0) + [105]=> + int(0) + [106]=> + int(0) + [107]=> + int(0) + [108]=> + int(0) + [109]=> + int(0) + [110]=> + int(0) + [111]=> + int(0) + [112]=> + int(0) + [113]=> + int(0) + [114]=> + int(0) + [115]=> + int(0) + [116]=> + int(0) + [117]=> + int(0) + [118]=> + int(0) + [119]=> + int(0) + [120]=> + int(0) + [121]=> + int(0) + [122]=> + int(0) + [123]=> + int(0) + [124]=> + int(0) + [125]=> + int(0) + [126]=> + int(0) + [127]=> + int(0) + [128]=> + int(0) + [129]=> + int(0) + [130]=> + int(0) + [131]=> + int(0) + [132]=> + int(0) + [133]=> + int(0) + [134]=> + int(0) + [135]=> + int(0) + [136]=> + int(0) + [137]=> + int(0) + [138]=> + int(0) + [139]=> + int(0) + [140]=> + int(0) + [141]=> + int(0) + [142]=> + int(0) + [143]=> + int(0) + [144]=> + int(0) + [145]=> + int(0) + [146]=> + int(0) + [147]=> + int(0) + [148]=> + int(0) + [149]=> + int(0) + [150]=> + int(0) + [151]=> + int(0) + [152]=> + int(0) + [153]=> + int(0) + [154]=> + int(0) + [155]=> + int(0) + [156]=> + int(0) + [157]=> + int(0) + [158]=> + int(0) + [159]=> + int(0) + [160]=> + int(0) + [161]=> + int(0) + [162]=> + int(0) + [163]=> + int(0) + [164]=> + int(0) + [165]=> + int(0) + [166]=> + int(0) + [167]=> + int(0) + [168]=> + int(0) + [169]=> + int(0) + [170]=> + int(0) + [171]=> + int(0) + [172]=> + int(0) + [173]=> + int(0) + [174]=> + int(0) + [175]=> + int(0) + [176]=> + int(0) + [177]=> + int(0) + [178]=> + int(0) + [179]=> + int(0) + [180]=> + int(0) + [181]=> + int(0) + [182]=> + int(0) + [183]=> + int(0) + [184]=> + int(0) + [185]=> + int(0) + [186]=> + int(0) + [187]=> + int(0) + [188]=> + int(0) + [189]=> + int(0) + [190]=> + int(0) + [191]=> + int(0) + [192]=> + int(0) + [193]=> + int(0) + [194]=> + int(0) + [195]=> + int(0) + [196]=> + int(0) + [197]=> + int(0) + [198]=> + int(0) + [199]=> + int(0) + [200]=> + int(0) + [201]=> + int(0) + [202]=> + int(0) + [203]=> + int(0) + [204]=> + int(0) + [205]=> + int(0) + [206]=> + int(0) + [207]=> + int(0) + [208]=> + int(0) + [209]=> + int(0) + [210]=> + int(0) + [211]=> + int(0) + [212]=> + int(0) + [213]=> + int(0) + [214]=> + int(0) + [215]=> + int(0) + [216]=> + int(0) + [217]=> + int(0) + [218]=> + int(0) + [219]=> + int(0) + [220]=> + int(0) + [221]=> + int(0) + [222]=> + int(0) + [223]=> + int(0) + [224]=> + int(0) + [225]=> + int(0) + [226]=> + int(0) + [227]=> + int(0) + [228]=> + int(0) + [229]=> + int(0) + [230]=> + int(0) + [231]=> + int(0) + [232]=> + int(0) + [233]=> + int(0) + [234]=> + int(0) + [235]=> + int(0) + [236]=> + int(0) + [237]=> + int(0) + [238]=> + int(0) + [239]=> + int(0) + [240]=> + int(0) + [241]=> + int(0) + [242]=> + int(0) + [243]=> + int(0) + [244]=> + int(0) + [245]=> + int(0) + [246]=> + int(0) + [247]=> + int(0) + [248]=> + int(0) + [249]=> + int(0) + [250]=> + int(0) + [251]=> + int(0) + [252]=> + int(0) + [253]=> + int(0) + [254]=> + int(0) + [255]=> + int(1) + [256]=> + int(0) + [257]=> + int(65280) + [258]=> + int(32512) + [259]=> + int(49152) + [260]=> + int(0) + [261]=> + int(0) + [262]=> + int(0) + [263]=> + int(0) + [264]=> + int(0) + [265]=> + int(0) + [266]=> + int(0) + [267]=> + int(0) + [268]=> + int(0) + [269]=> + int(0) + [270]=> + int(0) + [271]=> + int(0) + [272]=> + int(11945) + [273]=> + int(1914) + [274]=> + int(0) + [275]=> + int(24609) + [276]=> + int(1088) + [277]=> + int(960) + [278]=> + int(0) + [279]=> + int(0) + [280]=> + int(20000) + [281]=> + int(8414) + [282]=> + int(65436) + [283]=> + int(0) + [284]=> + int(47655) + [285]=> + int(8) + [286]=> + int(37936) + [287]=> + int(8406) + [288]=> + int(0) + [289]=> + int(0) + [290]=> + int(0) + [291]=> + int(0) + [292]=> + int(0) + [293]=> + int(0) + [294]=> + int(0) + [295]=> + int(0) + [296]=> + int(0) + [297]=> + int(64652) + [298]=> + int(50264) + [299]=> + int(0) + [300]=> + int(0) + [301]=> + int(64887) + [302]=> + int(50264) + [303]=> + int(0) + [304]=> + int(25714) + [305]=> + int(26220) + [306]=> + int(17235) + [307]=> + int(19777) + [308]=> + int(65535) + [309]=> + int(65535) + [310]=> + int(65535) + [311]=> + int(65535) + [312]=> + int(65535) + [313]=> + int(65535) + [314]=> + int(65535) + [315]=> + int(65535) + [316]=> + int(501) + [317]=> + int(0) + [318]=> + int(20) + [319]=> + int(0) + [320]=> + int(0) + [321]=> + int(0) + [322]=> + int(16877) + [323]=> + int(0) + [324]=> + int(3) + [325]=> + int(0) + [326]=> + int(0) + [327]=> + int(0) + [328]=> + int(0) + [329]=> + int(0) + [330]=> + int(0) + [331]=> + int(0) + [332]=> + int(65535) + [333]=> + int(65535) + [334]=> + int(65535) + [335]=> + int(65535) + [336]=> + int(65535) + [337]=> + int(65535) + [338]=> + int(65535) + [339]=> + int(65535) + [340]=> + int(0) + [341]=> + int(0) + [342]=> + int(52840) + [343]=> + int(2025) + [344]=> + int(16) + [345]=> + int(57377) + [346]=> + int(1024) + [347]=> + int(960) + [348]=> + int(0) + [349]=> + int(0) + [350]=> + int(27136) + [351]=> + int(8414) + [352]=> + int(65436) + [353]=> + int(0) + [354]=> + int(47655) + [355]=> + int(8) + [356]=> + int(62400) + [357]=> + int(8407) + [358]=> + int(0) + [359]=> + int(0) + [360]=> + int(0) + [361]=> + int(0) + [362]=> + int(0) + [363]=> + int(0) + [364]=> + int(0) + [365]=> + int(0) + [366]=> + int(0) + [367]=> + int(64857) + [368]=> + int(50264) + [369]=> + int(0) + [370]=> + int(0) + [371]=> + int(64892) + [372]=> + int(50264) + [373]=> + int(0) + [374]=> + int(25714) + [375]=> + int(26220) + [376]=> + int(17235) + [377]=> + int(19777) + [378]=> + int(65535) + [379]=> + int(65535) + [380]=> + int(65535) + [381]=> + int(65535) + [382]=> + int(65535) + [383]=> + int(65535) + [384]=> + int(65535) + [385]=> + int(65535) + [386]=> + int(501) + [387]=> + int(0) + [388]=> + int(20) + [389]=> + int(0) + [390]=> + int(0) + [391]=> + int(0) + [392]=> + int(16877) + [393]=> + int(0) + [394]=> + int(3) + [395]=> + int(0) + [396]=> + int(0) + [397]=> + int(0) + [398]=> + int(0) + [399]=> + int(0) + [400]=> + int(0) + [401]=> + int(0) + [402]=> + int(65535) + [403]=> + int(65535) + [404]=> + int(65535) + [405]=> + int(65535) + [406]=> + int(65535) + [407]=> + int(65535) + [408]=> + int(65535) + [409]=> + int(65535) + [410]=> + int(0) + [411]=> + int(0) + [412]=> + int(53440) + [413]=> + int(2025) + [414]=> + int(16) + [415]=> + int(57377) + [416]=> + int(1024) + [417]=> + int(960) + [418]=> + int(0) + [419]=> + int(0) + [420]=> + int(41120) + [421]=> + int(9024) + [422]=> + int(65436) + [423]=> + int(0) + [424]=> + int(47655) + [425]=> + int(8) + [426]=> + int(24480) + [427]=> + int(8404) + [428]=> + int(0) + [429]=> + int(0) + [430]=> + int(0) + [431]=> + int(0) + [432]=> + int(0) + [433]=> + int(0) + [434]=> + int(0) + [435]=> + int(0) + [436]=> + int(0) + [437]=> + int(21315) + [438]=> + int(50294) + [439]=> + int(0) + [440]=> + int(0) + [441]=> + int(53635) + [442]=> + int(50294) + [443]=> + int(0) + [444]=> + int(25714) + [445]=> + int(26220) + [446]=> + int(17235) + [447]=> + int(19777) + [448]=> + int(65535) + [449]=> + int(65535) + [450]=> + int(65535) + [451]=> + int(65535) + [452]=> + int(65535) + [453]=> + int(65535) + [454]=> + int(65535) + [455]=> + int(65535) + [456]=> + int(501) + [457]=> + int(0) + [458]=> + int(20) + [459]=> + int(0) + [460]=> + int(0) + [461]=> + int(0) + [462]=> + int(16877) + [463]=> + int(0) + [464]=> + int(3) + [465]=> + int(0) + [466]=> + int(0) + [467]=> + int(0) + [468]=> + int(0) + [469]=> + int(0) + [470]=> + int(0) + [471]=> + int(0) + [472]=> + int(65535) + [473]=> + int(65535) + [474]=> + int(65535) + [475]=> + int(65535) + [476]=> + int(65535) + [477]=> + int(65535) + [478]=> + int(65535) + [479]=> + int(65535) + [480]=> + int(0) + [481]=> + int(0) + [482]=> + int(54028) + [483]=> + int(2772) + [484]=> + int(16) + [485]=> + int(57377) + [486]=> + int(1024) + [487]=> + int(960) + [488]=> + int(0) + [489]=> + int(0) + [490]=> + int(42384) + [491]=> + int(8408) + [492]=> + int(65436) + [493]=> + int(0) + [494]=> + int(47655) + [495]=> + int(8) + [496]=> + int(1136) + [497]=> + int(8348) + [498]=> + int(0) + [499]=> + int(0) + [500]=> + int(0) + [501]=> + int(0) + [502]=> + int(0) + [503]=> + int(0) + [504]=> + int(0) + [505]=> + int(0) + [506]=> + int(0) + [507]=> + int(12326) + [508]=> + int(50261) + [509]=> + int(0) + [510]=> + int(0) + [511]=> + int(12326) + [512]=> + int(0) + [513]=> + int(65280) + [514]=> + int(32512) + [515]=> + int(49152) + [516]=> + int(0) + [517]=> + int(0) + [518]=> + int(22663) + [519]=> + int(2) + [520]=> + int(0) + [521]=> + int(0) + [522]=> + int(24576) + [523]=> + int(2) + [524]=> + int(0) + [525]=> + int(0) + [526]=> + int(501) + [527]=> + int(0) + [528]=> + int(20) + [529]=> + int(0) + [530]=> + int(0) + [531]=> + int(0) + [532]=> + int(33188) + [533]=> + int(0) + [534]=> + int(0) + [535]=> + int(0) + [536]=> + int(0) + [537]=> + int(0) + [538]=> + int(0) + [539]=> + int(0) + [540]=> + int(0) + [541]=> + int(0) + [542]=> + int(0) + [543]=> + int(0) + [544]=> + int(0) + [545]=> + int(0) + [546]=> + int(0) + [547]=> + int(0) + [548]=> + int(0) + [549]=> + int(0) + [550]=> + int(0) + [551]=> + int(0) + [552]=> + int(51766) + [553]=> + int(1946) + [554]=> + int(0) + [555]=> + int(24609) + [556]=> + int(1088) + [557]=> + int(960) + [558]=> + int(0) + [559]=> + int(0) + [560]=> + int(0) + [561]=> + int(0) + [562]=> + int(25116) + [563]=> + int(2012) + [564]=> + int(0) + [565]=> + int(0) + [566]=> + int(0) + [567]=> + int(0) + [568]=> + int(0) + [569]=> + int(0) + [570]=> + int(0) + [571]=> + int(0) + [572]=> + int(0) + [573]=> + int(0) + [574]=> + int(0) + [575]=> + int(0) + [576]=> + int(0) + [577]=> + int(0) + [578]=> + int(0) + [579]=> + int(0) + [580]=> + int(0) + [581]=> + int(0) + [582]=> + int(0) + [583]=> + int(0) + [584]=> + int(0) + [585]=> + int(0) + [586]=> + int(0) + [587]=> + int(0) + [588]=> + int(0) + [589]=> + int(0) + [590]=> + int(0) + [591]=> + int(0) + [592]=> + int(0) + [593]=> + int(0) + [594]=> + int(0) + [595]=> + int(0) + [596]=> + int(0) + [597]=> + int(0) + [598]=> + int(0) + [599]=> + int(0) + [600]=> + int(0) + [601]=> + int(0) + [602]=> + int(0) + [603]=> + int(0) + [604]=> + int(0) + [605]=> + int(0) + [606]=> + int(0) + [607]=> + int(0) + [608]=> + int(0) + [609]=> + int(0) + [610]=> + int(0) + [611]=> + int(0) + [612]=> + int(0) + [613]=> + int(0) + [614]=> + int(0) + [615]=> + int(0) + [616]=> + int(0) + [617]=> + int(0) + [618]=> + int(0) + [619]=> + int(0) + [620]=> + int(0) + [621]=> + int(0) + [622]=> + int(0) + [623]=> + int(0) + [624]=> + int(0) + [625]=> + int(0) + [626]=> + int(0) + [627]=> + int(0) + [628]=> + int(0) + [629]=> + int(0) + [630]=> + int(0) + [631]=> + int(0) + [632]=> + int(0) + [633]=> + int(0) + [634]=> + int(0) + [635]=> + int(0) + [636]=> + int(0) + [637]=> + int(0) + [638]=> + int(0) + [639]=> + int(0) + [640]=> + int(0) + [641]=> + int(0) + [642]=> + int(0) + [643]=> + int(0) + [644]=> + int(0) + [645]=> + int(0) + [646]=> + int(0) + [647]=> + int(0) + [648]=> + int(0) + [649]=> + int(0) + [650]=> + int(0) + [651]=> + int(0) + [652]=> + int(0) + [653]=> + int(0) + [654]=> + int(0) + [655]=> + int(0) + [656]=> + int(0) + [657]=> + int(0) + [658]=> + int(0) + [659]=> + int(0) + [660]=> + int(0) + [661]=> + int(0) + [662]=> + int(0) + [663]=> + int(0) + [664]=> + int(0) + [665]=> + int(0) + [666]=> + int(0) + [667]=> + int(0) + [668]=> + int(0) + [669]=> + int(0) + [670]=> + int(0) + [671]=> + int(0) + [672]=> + int(0) + [673]=> + int(0) + [674]=> + int(0) + [675]=> + int(0) + [676]=> + int(0) + [677]=> + int(0) + [678]=> + int(0) + [679]=> + int(0) + [680]=> + int(0) + [681]=> + int(0) + [682]=> + int(0) + [683]=> + int(0) + [684]=> + int(0) + [685]=> + int(0) + [686]=> + int(0) + [687]=> + int(0) + [688]=> + int(0) + [689]=> + int(0) + [690]=> + int(0) + [691]=> + int(0) + [692]=> + int(0) + [693]=> + int(0) + [694]=> + int(0) + [695]=> + int(0) + [696]=> + int(0) + [697]=> + int(0) + [698]=> + int(0) + [699]=> + int(0) + [700]=> + int(0) + [701]=> + int(0) + [702]=> + int(0) + [703]=> + int(0) + [704]=> + int(0) + [705]=> + int(0) + [706]=> + int(0) + [707]=> + int(0) + [708]=> + int(0) + [709]=> + int(0) + [710]=> + int(0) + [711]=> + int(0) + [712]=> + int(0) + [713]=> + int(0) + [714]=> + int(0) + [715]=> + int(0) + [716]=> + int(0) + [717]=> + int(0) + [718]=> + int(0) + [719]=> + int(0) + [720]=> + int(0) + [721]=> + int(0) + [722]=> + int(0) + [723]=> + int(0) + [724]=> + int(0) + [725]=> + int(0) + [726]=> + int(0) + [727]=> + int(0) + [728]=> + int(0) + [729]=> + int(0) + [730]=> + int(0) + [731]=> + int(0) + [732]=> + int(0) + [733]=> + int(0) + [734]=> + int(0) + [735]=> + int(0) + [736]=> + int(0) + [737]=> + int(0) + [738]=> + int(0) + [739]=> + int(0) + [740]=> + int(0) + [741]=> + int(0) + [742]=> + int(0) + [743]=> + int(0) + [744]=> + int(0) + [745]=> + int(0) + [746]=> + int(0) + [747]=> + int(0) + [748]=> + int(0) + [749]=> + int(0) + [750]=> + int(0) + [751]=> + int(0) + [752]=> + int(0) + [753]=> + int(0) + [754]=> + int(0) + [755]=> + int(0) + [756]=> + int(0) + [757]=> + int(0) + [758]=> + int(0) + [759]=> + int(0) + [760]=> + int(0) + [761]=> + int(0) + [762]=> + int(0) + [763]=> + int(0) + [764]=> + int(0) + [765]=> + int(0) + [766]=> + int(0) + [767]=> + int(0) + } + ["Copyright"]=> + string(12) "Eric Stewart" + ["InterOperabilityIndex"]=> + string(3) "R98" + ["InterOperabilityVersion"]=> + string(4) "0100" + ["RelatedFileFormat"]=> + string(13) "image026.tiff" + ["RelatedImageWidth"]=> + int(1) + ["RelatedImageHeight"]=> + int(1) +} +--CREDIT-- +Eric Stewart <ericleestewart@gmail.com> diff --git a/ext/exif/tests/exif027.phpt b/ext/exif/tests/exif027.phpt new file mode 100644 index 0000000..f527c37 --- /dev/null +++ b/ext/exif/tests/exif027.phpt @@ -0,0 +1,1632 @@ +--TEST-- +Check for exif_read_data, TIFF with IFD0, EXIF, INTEROP data in Motorola byte-order. +--SKIPIF-- +<?php if (!extension_loaded('exif')) print 'skip exif extension not available';?> +--INI-- +output_handler= +zlib.output_compression=0 +--FILE-- +<?php +var_dump(exif_read_data(dirname(__FILE__).'/image027.tiff')); +?> +--EXPECTF-- +array(31) { + ["FileName"]=> + string(13) "image027.tiff" + ["FileDateTime"]=> + int(%d) + ["FileSize"]=> + int(%d) + ["FileType"]=> + int(8) + ["MimeType"]=> + string(10) "image/tiff" + ["SectionsFound"]=> + string(28) "ANY_TAG, IFD0, EXIF, INTEROP" + ["COMPUTED"]=> + array(8) { + ["html"]=> + string(20) "width="1" height="1"" + ["Height"]=> + int(1) + ["Width"]=> + int(1) + ["IsColor"]=> + int(1) + ["ByteOrderMotorola"]=> + int(1) + ["Copyright"]=> + string(24) "Eric Stewart, Hex Editor" + ["Copyright.Photographer"]=> + string(12) "Eric Stewart" + ["Copyright.Editor"]=> + string(10) "Hex Editor" + } + ["ImageWidth"]=> + int(1) + ["ImageLength"]=> + int(1) + ["BitsPerSample"]=> + int(8) + ["Compression"]=> + int(5) + ["PhotometricInterpretation"]=> + int(3) + ["ImageDescription"]=> + string(15) "My description." + ["Make"]=> + string(11) "OpenShutter" + ["Model"]=> + string(8) "OS 1.0.0" + ["StripOffsets"]=> + int(1980) + ["SamplesPerPixel"]=> + int(1) + ["RowsPerStrip"]=> + int(8) + ["StripByteCounts"]=> + int(4) + ["XResolution"]=> + string(17) "381681664/2097152" + ["YResolution"]=> + string(17) "381681664/2097152" + ["PlanarConfiguration"]=> + int(1) + ["ResolutionUnit"]=> + int(2) + ["Artist"]=> + string(12) "Eric Stewart" + ["ColorMap"]=> + array(768) { + [0]=> + int(0) + [1]=> + int(65280) + [2]=> + int(32512) + [3]=> + int(49152) + [4]=> + int(99) + [5]=> + int(115) + [6]=> + int(116) + [7]=> + int(101) + [8]=> + int(119) + [9]=> + int(97) + [10]=> + int(114) + [11]=> + int(116) + [12]=> + int(0) + [13]=> + int(0) + [14]=> + int(0) + [15]=> + int(0) + [16]=> + int(0) + [17]=> + int(0) + [18]=> + int(0) + [19]=> + int(0) + [20]=> + int(0) + [21]=> + int(0) + [22]=> + int(0) + [23]=> + int(0) + [24]=> + int(0) + [25]=> + int(0) + [26]=> + int(0) + [27]=> + int(0) + [28]=> + int(0) + [29]=> + int(0) + [30]=> + int(0) + [31]=> + int(0) + [32]=> + int(0) + [33]=> + int(0) + [34]=> + int(0) + [35]=> + int(0) + [36]=> + int(0) + [37]=> + int(0) + [38]=> + int(0) + [39]=> + int(0) + [40]=> + int(0) + [41]=> + int(0) + [42]=> + int(0) + [43]=> + int(0) + [44]=> + int(0) + [45]=> + int(0) + [46]=> + int(0) + [47]=> + int(0) + [48]=> + int(0) + [49]=> + int(0) + [50]=> + int(0) + [51]=> + int(0) + [52]=> + int(0) + [53]=> + int(0) + [54]=> + int(0) + [55]=> + int(0) + [56]=> + int(0) + [57]=> + int(0) + [58]=> + int(0) + [59]=> + int(0) + [60]=> + int(0) + [61]=> + int(0) + [62]=> + int(0) + [63]=> + int(0) + [64]=> + int(0) + [65]=> + int(0) + [66]=> + int(0) + [67]=> + int(0) + [68]=> + int(0) + [69]=> + int(0) + [70]=> + int(0) + [71]=> + int(0) + [72]=> + int(0) + [73]=> + int(0) + [74]=> + int(0) + [75]=> + int(0) + [76]=> + int(0) + [77]=> + int(0) + [78]=> + int(0) + [79]=> + int(0) + [80]=> + int(0) + [81]=> + int(0) + [82]=> + int(0) + [83]=> + int(0) + [84]=> + int(0) + [85]=> + int(0) + [86]=> + int(0) + [87]=> + int(0) + [88]=> + int(0) + [89]=> + int(0) + [90]=> + int(0) + [91]=> + int(0) + [92]=> + int(0) + [93]=> + int(0) + [94]=> + int(0) + [95]=> + int(0) + [96]=> + int(0) + [97]=> + int(0) + [98]=> + int(0) + [99]=> + int(0) + [100]=> + int(0) + [101]=> + int(0) + [102]=> + int(0) + [103]=> + int(0) + [104]=> + int(0) + [105]=> + int(0) + [106]=> + int(0) + [107]=> + int(0) + [108]=> + int(0) + [109]=> + int(0) + [110]=> + int(0) + [111]=> + int(0) + [112]=> + int(0) + [113]=> + int(0) + [114]=> + int(0) + [115]=> + int(0) + [116]=> + int(0) + [117]=> + int(0) + [118]=> + int(0) + [119]=> + int(0) + [120]=> + int(0) + [121]=> + int(0) + [122]=> + int(0) + [123]=> + int(0) + [124]=> + int(0) + [125]=> + int(0) + [126]=> + int(0) + [127]=> + int(0) + [128]=> + int(0) + [129]=> + int(0) + [130]=> + int(0) + [131]=> + int(0) + [132]=> + int(0) + [133]=> + int(0) + [134]=> + int(0) + [135]=> + int(0) + [136]=> + int(0) + [137]=> + int(0) + [138]=> + int(0) + [139]=> + int(0) + [140]=> + int(0) + [141]=> + int(0) + [142]=> + int(0) + [143]=> + int(0) + [144]=> + int(0) + [145]=> + int(0) + [146]=> + int(0) + [147]=> + int(0) + [148]=> + int(0) + [149]=> + int(0) + [150]=> + int(0) + [151]=> + int(0) + [152]=> + int(0) + [153]=> + int(0) + [154]=> + int(0) + [155]=> + int(0) + [156]=> + int(0) + [157]=> + int(0) + [158]=> + int(0) + [159]=> + int(0) + [160]=> + int(0) + [161]=> + int(0) + [162]=> + int(0) + [163]=> + int(0) + [164]=> + int(0) + [165]=> + int(0) + [166]=> + int(0) + [167]=> + int(0) + [168]=> + int(0) + [169]=> + int(0) + [170]=> + int(0) + [171]=> + int(0) + [172]=> + int(0) + [173]=> + int(0) + [174]=> + int(0) + [175]=> + int(0) + [176]=> + int(0) + [177]=> + int(0) + [178]=> + int(0) + [179]=> + int(0) + [180]=> + int(0) + [181]=> + int(0) + [182]=> + int(0) + [183]=> + int(0) + [184]=> + int(0) + [185]=> + int(0) + [186]=> + int(0) + [187]=> + int(0) + [188]=> + int(0) + [189]=> + int(0) + [190]=> + int(0) + [191]=> + int(0) + [192]=> + int(0) + [193]=> + int(0) + [194]=> + int(0) + [195]=> + int(0) + [196]=> + int(0) + [197]=> + int(0) + [198]=> + int(0) + [199]=> + int(0) + [200]=> + int(0) + [201]=> + int(0) + [202]=> + int(0) + [203]=> + int(0) + [204]=> + int(0) + [205]=> + int(0) + [206]=> + int(0) + [207]=> + int(0) + [208]=> + int(0) + [209]=> + int(0) + [210]=> + int(0) + [211]=> + int(0) + [212]=> + int(0) + [213]=> + int(0) + [214]=> + int(0) + [215]=> + int(0) + [216]=> + int(0) + [217]=> + int(0) + [218]=> + int(0) + [219]=> + int(0) + [220]=> + int(0) + [221]=> + int(0) + [222]=> + int(0) + [223]=> + int(0) + [224]=> + int(0) + [225]=> + int(0) + [226]=> + int(0) + [227]=> + int(0) + [228]=> + int(0) + [229]=> + int(0) + [230]=> + int(0) + [231]=> + int(0) + [232]=> + int(0) + [233]=> + int(0) + [234]=> + int(0) + [235]=> + int(0) + [236]=> + int(0) + [237]=> + int(0) + [238]=> + int(0) + [239]=> + int(0) + [240]=> + int(0) + [241]=> + int(0) + [242]=> + int(0) + [243]=> + int(0) + [244]=> + int(0) + [245]=> + int(0) + [246]=> + int(0) + [247]=> + int(0) + [248]=> + int(0) + [249]=> + int(0) + [250]=> + int(0) + [251]=> + int(0) + [252]=> + int(0) + [253]=> + int(0) + [254]=> + int(0) + [255]=> + int(1) + [256]=> + int(0) + [257]=> + int(65280) + [258]=> + int(32512) + [259]=> + int(49152) + [260]=> + int(0) + [261]=> + int(0) + [262]=> + int(0) + [263]=> + int(0) + [264]=> + int(0) + [265]=> + int(0) + [266]=> + int(0) + [267]=> + int(0) + [268]=> + int(0) + [269]=> + int(0) + [270]=> + int(0) + [271]=> + int(0) + [272]=> + int(11945) + [273]=> + int(1914) + [274]=> + int(0) + [275]=> + int(24609) + [276]=> + int(1088) + [277]=> + int(960) + [278]=> + int(0) + [279]=> + int(0) + [280]=> + int(20000) + [281]=> + int(8414) + [282]=> + int(65436) + [283]=> + int(0) + [284]=> + int(47655) + [285]=> + int(8) + [286]=> + int(37936) + [287]=> + int(8406) + [288]=> + int(0) + [289]=> + int(0) + [290]=> + int(0) + [291]=> + int(0) + [292]=> + int(0) + [293]=> + int(0) + [294]=> + int(0) + [295]=> + int(0) + [296]=> + int(0) + [297]=> + int(64652) + [298]=> + int(50264) + [299]=> + int(0) + [300]=> + int(0) + [301]=> + int(64887) + [302]=> + int(50264) + [303]=> + int(0) + [304]=> + int(25714) + [305]=> + int(26220) + [306]=> + int(17235) + [307]=> + int(19777) + [308]=> + int(65535) + [309]=> + int(65535) + [310]=> + int(65535) + [311]=> + int(65535) + [312]=> + int(65535) + [313]=> + int(65535) + [314]=> + int(65535) + [315]=> + int(65535) + [316]=> + int(501) + [317]=> + int(0) + [318]=> + int(20) + [319]=> + int(0) + [320]=> + int(0) + [321]=> + int(0) + [322]=> + int(16877) + [323]=> + int(0) + [324]=> + int(3) + [325]=> + int(0) + [326]=> + int(0) + [327]=> + int(0) + [328]=> + int(0) + [329]=> + int(0) + [330]=> + int(0) + [331]=> + int(0) + [332]=> + int(65535) + [333]=> + int(65535) + [334]=> + int(65535) + [335]=> + int(65535) + [336]=> + int(65535) + [337]=> + int(65535) + [338]=> + int(65535) + [339]=> + int(65535) + [340]=> + int(0) + [341]=> + int(0) + [342]=> + int(52840) + [343]=> + int(2025) + [344]=> + int(16) + [345]=> + int(57377) + [346]=> + int(1024) + [347]=> + int(960) + [348]=> + int(0) + [349]=> + int(0) + [350]=> + int(27136) + [351]=> + int(8414) + [352]=> + int(65436) + [353]=> + int(0) + [354]=> + int(47655) + [355]=> + int(8) + [356]=> + int(62400) + [357]=> + int(8407) + [358]=> + int(0) + [359]=> + int(0) + [360]=> + int(0) + [361]=> + int(0) + [362]=> + int(0) + [363]=> + int(0) + [364]=> + int(0) + [365]=> + int(0) + [366]=> + int(0) + [367]=> + int(64857) + [368]=> + int(50264) + [369]=> + int(0) + [370]=> + int(0) + [371]=> + int(64892) + [372]=> + int(50264) + [373]=> + int(0) + [374]=> + int(25714) + [375]=> + int(26220) + [376]=> + int(17235) + [377]=> + int(19777) + [378]=> + int(65535) + [379]=> + int(65535) + [380]=> + int(65535) + [381]=> + int(65535) + [382]=> + int(65535) + [383]=> + int(65535) + [384]=> + int(65535) + [385]=> + int(65535) + [386]=> + int(501) + [387]=> + int(0) + [388]=> + int(20) + [389]=> + int(0) + [390]=> + int(0) + [391]=> + int(0) + [392]=> + int(16877) + [393]=> + int(0) + [394]=> + int(3) + [395]=> + int(0) + [396]=> + int(0) + [397]=> + int(0) + [398]=> + int(0) + [399]=> + int(0) + [400]=> + int(0) + [401]=> + int(0) + [402]=> + int(65535) + [403]=> + int(65535) + [404]=> + int(65535) + [405]=> + int(65535) + [406]=> + int(65535) + [407]=> + int(65535) + [408]=> + int(65535) + [409]=> + int(65535) + [410]=> + int(0) + [411]=> + int(0) + [412]=> + int(53440) + [413]=> + int(2025) + [414]=> + int(16) + [415]=> + int(57377) + [416]=> + int(1024) + [417]=> + int(960) + [418]=> + int(0) + [419]=> + int(0) + [420]=> + int(41120) + [421]=> + int(9024) + [422]=> + int(65436) + [423]=> + int(0) + [424]=> + int(47655) + [425]=> + int(8) + [426]=> + int(24480) + [427]=> + int(8404) + [428]=> + int(0) + [429]=> + int(0) + [430]=> + int(0) + [431]=> + int(0) + [432]=> + int(0) + [433]=> + int(0) + [434]=> + int(0) + [435]=> + int(0) + [436]=> + int(0) + [437]=> + int(21315) + [438]=> + int(50294) + [439]=> + int(0) + [440]=> + int(0) + [441]=> + int(53635) + [442]=> + int(50294) + [443]=> + int(0) + [444]=> + int(25714) + [445]=> + int(26220) + [446]=> + int(17235) + [447]=> + int(19777) + [448]=> + int(65535) + [449]=> + int(65535) + [450]=> + int(65535) + [451]=> + int(65535) + [452]=> + int(65535) + [453]=> + int(65535) + [454]=> + int(65535) + [455]=> + int(65535) + [456]=> + int(501) + [457]=> + int(0) + [458]=> + int(20) + [459]=> + int(0) + [460]=> + int(0) + [461]=> + int(0) + [462]=> + int(16877) + [463]=> + int(0) + [464]=> + int(3) + [465]=> + int(0) + [466]=> + int(0) + [467]=> + int(0) + [468]=> + int(0) + [469]=> + int(0) + [470]=> + int(0) + [471]=> + int(0) + [472]=> + int(65535) + [473]=> + int(65535) + [474]=> + int(65535) + [475]=> + int(65535) + [476]=> + int(65535) + [477]=> + int(65535) + [478]=> + int(65535) + [479]=> + int(65535) + [480]=> + int(0) + [481]=> + int(0) + [482]=> + int(54028) + [483]=> + int(2772) + [484]=> + int(16) + [485]=> + int(57377) + [486]=> + int(1024) + [487]=> + int(960) + [488]=> + int(0) + [489]=> + int(0) + [490]=> + int(42384) + [491]=> + int(8408) + [492]=> + int(65436) + [493]=> + int(0) + [494]=> + int(47655) + [495]=> + int(8) + [496]=> + int(1136) + [497]=> + int(8348) + [498]=> + int(0) + [499]=> + int(0) + [500]=> + int(0) + [501]=> + int(0) + [502]=> + int(0) + [503]=> + int(0) + [504]=> + int(0) + [505]=> + int(0) + [506]=> + int(0) + [507]=> + int(12326) + [508]=> + int(50261) + [509]=> + int(0) + [510]=> + int(0) + [511]=> + int(12326) + [512]=> + int(0) + [513]=> + int(65280) + [514]=> + int(32512) + [515]=> + int(49152) + [516]=> + int(0) + [517]=> + int(0) + [518]=> + int(22663) + [519]=> + int(2) + [520]=> + int(0) + [521]=> + int(0) + [522]=> + int(24576) + [523]=> + int(2) + [524]=> + int(0) + [525]=> + int(0) + [526]=> + int(501) + [527]=> + int(0) + [528]=> + int(20) + [529]=> + int(0) + [530]=> + int(0) + [531]=> + int(0) + [532]=> + int(33188) + [533]=> + int(0) + [534]=> + int(0) + [535]=> + int(0) + [536]=> + int(0) + [537]=> + int(0) + [538]=> + int(0) + [539]=> + int(0) + [540]=> + int(0) + [541]=> + int(0) + [542]=> + int(0) + [543]=> + int(0) + [544]=> + int(0) + [545]=> + int(0) + [546]=> + int(0) + [547]=> + int(0) + [548]=> + int(0) + [549]=> + int(0) + [550]=> + int(0) + [551]=> + int(0) + [552]=> + int(51766) + [553]=> + int(1946) + [554]=> + int(0) + [555]=> + int(24609) + [556]=> + int(1088) + [557]=> + int(960) + [558]=> + int(0) + [559]=> + int(0) + [560]=> + int(0) + [561]=> + int(0) + [562]=> + int(25116) + [563]=> + int(2012) + [564]=> + int(0) + [565]=> + int(0) + [566]=> + int(0) + [567]=> + int(0) + [568]=> + int(0) + [569]=> + int(0) + [570]=> + int(0) + [571]=> + int(0) + [572]=> + int(0) + [573]=> + int(0) + [574]=> + int(0) + [575]=> + int(0) + [576]=> + int(0) + [577]=> + int(0) + [578]=> + int(0) + [579]=> + int(0) + [580]=> + int(0) + [581]=> + int(0) + [582]=> + int(0) + [583]=> + int(0) + [584]=> + int(0) + [585]=> + int(0) + [586]=> + int(0) + [587]=> + int(0) + [588]=> + int(0) + [589]=> + int(0) + [590]=> + int(0) + [591]=> + int(0) + [592]=> + int(0) + [593]=> + int(0) + [594]=> + int(0) + [595]=> + int(0) + [596]=> + int(0) + [597]=> + int(0) + [598]=> + int(0) + [599]=> + int(0) + [600]=> + int(0) + [601]=> + int(0) + [602]=> + int(0) + [603]=> + int(0) + [604]=> + int(0) + [605]=> + int(0) + [606]=> + int(0) + [607]=> + int(0) + [608]=> + int(0) + [609]=> + int(0) + [610]=> + int(0) + [611]=> + int(0) + [612]=> + int(0) + [613]=> + int(0) + [614]=> + int(0) + [615]=> + int(0) + [616]=> + int(0) + [617]=> + int(0) + [618]=> + int(0) + [619]=> + int(0) + [620]=> + int(0) + [621]=> + int(0) + [622]=> + int(0) + [623]=> + int(0) + [624]=> + int(0) + [625]=> + int(0) + [626]=> + int(0) + [627]=> + int(0) + [628]=> + int(0) + [629]=> + int(0) + [630]=> + int(0) + [631]=> + int(0) + [632]=> + int(0) + [633]=> + int(0) + [634]=> + int(0) + [635]=> + int(0) + [636]=> + int(0) + [637]=> + int(0) + [638]=> + int(0) + [639]=> + int(0) + [640]=> + int(0) + [641]=> + int(0) + [642]=> + int(0) + [643]=> + int(0) + [644]=> + int(0) + [645]=> + int(0) + [646]=> + int(0) + [647]=> + int(0) + [648]=> + int(0) + [649]=> + int(0) + [650]=> + int(0) + [651]=> + int(0) + [652]=> + int(0) + [653]=> + int(0) + [654]=> + int(0) + [655]=> + int(0) + [656]=> + int(0) + [657]=> + int(0) + [658]=> + int(0) + [659]=> + int(0) + [660]=> + int(0) + [661]=> + int(0) + [662]=> + int(0) + [663]=> + int(0) + [664]=> + int(0) + [665]=> + int(0) + [666]=> + int(0) + [667]=> + int(0) + [668]=> + int(0) + [669]=> + int(0) + [670]=> + int(0) + [671]=> + int(0) + [672]=> + int(0) + [673]=> + int(0) + [674]=> + int(0) + [675]=> + int(0) + [676]=> + int(0) + [677]=> + int(0) + [678]=> + int(0) + [679]=> + int(0) + [680]=> + int(0) + [681]=> + int(0) + [682]=> + int(0) + [683]=> + int(0) + [684]=> + int(0) + [685]=> + int(0) + [686]=> + int(0) + [687]=> + int(0) + [688]=> + int(0) + [689]=> + int(0) + [690]=> + int(0) + [691]=> + int(0) + [692]=> + int(0) + [693]=> + int(0) + [694]=> + int(0) + [695]=> + int(0) + [696]=> + int(0) + [697]=> + int(0) + [698]=> + int(0) + [699]=> + int(0) + [700]=> + int(0) + [701]=> + int(0) + [702]=> + int(0) + [703]=> + int(0) + [704]=> + int(0) + [705]=> + int(0) + [706]=> + int(0) + [707]=> + int(0) + [708]=> + int(0) + [709]=> + int(0) + [710]=> + int(0) + [711]=> + int(0) + [712]=> + int(0) + [713]=> + int(0) + [714]=> + int(0) + [715]=> + int(0) + [716]=> + int(0) + [717]=> + int(0) + [718]=> + int(0) + [719]=> + int(0) + [720]=> + int(0) + [721]=> + int(0) + [722]=> + int(0) + [723]=> + int(0) + [724]=> + int(0) + [725]=> + int(0) + [726]=> + int(0) + [727]=> + int(0) + [728]=> + int(0) + [729]=> + int(0) + [730]=> + int(0) + [731]=> + int(0) + [732]=> + int(0) + [733]=> + int(0) + [734]=> + int(0) + [735]=> + int(0) + [736]=> + int(0) + [737]=> + int(0) + [738]=> + int(0) + [739]=> + int(0) + [740]=> + int(0) + [741]=> + int(0) + [742]=> + int(0) + [743]=> + int(0) + [744]=> + int(0) + [745]=> + int(0) + [746]=> + int(0) + [747]=> + int(0) + [748]=> + int(0) + [749]=> + int(0) + [750]=> + int(0) + [751]=> + int(0) + [752]=> + int(0) + [753]=> + int(0) + [754]=> + int(0) + [755]=> + int(0) + [756]=> + int(0) + [757]=> + int(0) + [758]=> + int(0) + [759]=> + int(0) + [760]=> + int(0) + [761]=> + int(0) + [762]=> + int(0) + [763]=> + int(0) + [764]=> + int(0) + [765]=> + int(0) + [766]=> + int(0) + [767]=> + int(0) + } + ["Copyright"]=> + string(12) "Eric Stewart" + ["InterOperabilityIndex"]=> + string(3) "R98" + ["InterOperabilityVersion"]=> + string(4) "0100" + ["RelatedFileFormat"]=> + string(13) "image027.tiff" + ["RelatedImageWidth"]=> + int(1) + ["RelatedImageHeight"]=> + int(1) +} +--CREDIT-- +Eric Stewart <ericleestewart@gmail.com> diff --git a/ext/exif/tests/exif_imagetype_basic.phpt b/ext/exif/tests/exif_imagetype_basic.phpt new file mode 100644 index 0000000..1248d39 --- /dev/null +++ b/ext/exif/tests/exif_imagetype_basic.phpt @@ -0,0 +1,23 @@ +--TEST-- +Check for exif_imagetype default behaviour +--SKIPIF-- +<?php if (!extension_loaded('exif')) print 'skip exif extension not available';?> +--INI-- +output_handler= +zlib.output_compression=0 +--FILE-- +<?php + +/* Prototype : int exif_imagetype ( string $filename ) + * Description: Determine the type of an image + * Source code: ext/exif/exif.c +*/ +echo "*** Testing exif_imagetype() : basic functionality ***\n"; + +var_dump(exif_imagetype(dirname(__FILE__).'/test2.jpg')); +?> +===Done=== +--EXPECT-- +*** Testing exif_imagetype() : basic functionality *** +int(2) +===Done===
\ No newline at end of file diff --git a/ext/exif/tests/exif_imagetype_error.phpt b/ext/exif/tests/exif_imagetype_error.phpt new file mode 100644 index 0000000..989d02b --- /dev/null +++ b/ext/exif/tests/exif_imagetype_error.phpt @@ -0,0 +1,46 @@ +--TEST-- +Test exif_imagetype() function : error conditions +--SKIPIF-- +<?php if (!extension_loaded('exif')) print 'skip exif extension not available';?> +--FILE-- +<?php + +/* Prototype : int exif_imagetype ( string $filename ) + * Description: Determine the type of an image + * Source code: ext/exif/exif.c +*/ + +echo "*** Testing exif_imagetype() : error conditions ***\n"; + +echo "\n-- Testing exif_imagetype() function with no arguments --\n"; +var_dump( exif_imagetype() ); + +echo "\n-- Testing exif_imagetype() function with more than expected no. of arguments --\n"; +$extra_arg = 10; +var_dump( exif_imagetype(dirname(__FILE__).'/test2.jpg', $extra_arg) ); + +echo "\n-- Testing exif_imagetype() function with an unknown file --\n"; +var_dump( exif_imagetype(dirname(__FILE__).'/foo.jpg') ); + + +?> +===Done=== +--EXPECTF-- +*** Testing exif_imagetype() : error conditions *** + +-- Testing exif_imagetype() function with no arguments -- + +Warning: exif_imagetype() expects exactly 1 parameter, 0 given in %s on line %d +NULL + +-- Testing exif_imagetype() function with more than expected no. of arguments -- + +Warning: exif_imagetype() expects exactly 1 parameter, 2 given in %s on line %d +NULL + +-- Testing exif_imagetype() function with an unknown file -- + +Warning: exif_imagetype(%s/foo.jpg): failed to open stream: No such file or directory in %s on line %d +bool(false) +===Done=== + diff --git a/ext/exif/tests/exif_imagetype_variation1.phpt b/ext/exif/tests/exif_imagetype_variation1.phpt new file mode 100644 index 0000000..767ed5f --- /dev/null +++ b/ext/exif/tests/exif_imagetype_variation1.phpt @@ -0,0 +1,214 @@ +--TEST-- +Test exif_imagetype() function : usage variations - different types for filename argument +--SKIPIF-- +<?php if (!extension_loaded('exif')) print 'skip exif extension not available';?> +--FILE-- +<?php + +/* Prototype : int exif_imagetype ( string $filename ) + * Description: Determine the type of an image + * Source code: ext/exif/exif.c +*/ + +echo "*** Testing exif_imagetype() : different types for filename argument ***\n"; +// initialize all required variables + +// get an unset variable +$unset_var = 'string_val'; +unset($unset_var); + +// declaring a class +class sample { + public function __toString() { + return "obj'ct"; + } +} + +// Defining resource +$file_handle = fopen(__FILE__, 'r'); + +// array with different values +$values = array ( + + // integer values + 0, + 1, + 12345, + -2345, + + // float values + 10.5, + -10.5, + 10.1234567e10, + 10.7654321E-10, + .5, + + // array values + array(), + array(0), + array(1), + array(1, 2), + array('color' => 'red', 'item' => 'pen'), + + // boolean values + true, + false, + TRUE, + FALSE, + + // empty string + "", + '', + + // undefined variable + $undefined_var, + + // unset variable + $unset_var, + + // objects + new sample(), + + // resource + $file_handle, + + NULL, + null +); + + +// loop through each element of the array and check the working of exif_imagetype() +// when $filename is supplied with different values + +echo "\n--- Testing exif_imagetype() by supplying different values for 'filename' argument ---\n"; +$counter = 1; +foreach($values as $filename) { + echo "-- Iteration $counter --\n"; + var_dump( exif_imagetype($filename) ); + $counter ++; +} + +// closing the file +fclose($file_handle); + +echo "Done\n"; +?> + +?> +===Done=== +--EXPECTF-- +*** Testing exif_imagetype() : different types for filename argument *** + +Notice: Undefined variable: undefined_var in %s on line %d + +Notice: Undefined variable: unset_var in %s on line %d + +--- Testing exif_imagetype() by supplying different values for 'filename' argument --- +-- Iteration 1 -- + +Warning: exif_imagetype(0): failed to open stream: No such file or directory in %s on line %d +bool(false) +-- Iteration 2 -- + +Warning: exif_imagetype(1): failed to open stream: No such file or directory in %s on line %d +bool(false) +-- Iteration 3 -- + +Warning: exif_imagetype(12345): failed to open stream: No such file or directory in %s on line %d +bool(false) +-- Iteration 4 -- + +Warning: exif_imagetype(-2345): failed to open stream: No such file or directory in %s on line %d +bool(false) +-- Iteration 5 -- + +Warning: exif_imagetype(10.5): failed to open stream: No such file or directory in %s on line %d +bool(false) +-- Iteration 6 -- + +Warning: exif_imagetype(-10.5): failed to open stream: No such file or directory in %s on line %d +bool(false) +-- Iteration 7 -- + +Warning: exif_imagetype(101234567000): failed to open stream: No such file or directory in %s on line %d +bool(false) +-- Iteration 8 -- + +Warning: exif_imagetype(1.07654321E-9): failed to open stream: No such file or directory in %s on line %d +bool(false) +-- Iteration 9 -- + +Warning: exif_imagetype(0.5): failed to open stream: No such file or directory in %s on line %d +bool(false) +-- Iteration 10 -- + +Warning: exif_imagetype() expects parameter 1 to be string, array given in %s on line %d +NULL +-- Iteration 11 -- + +Warning: exif_imagetype() expects parameter 1 to be string, array given in %s on line %d +NULL +-- Iteration 12 -- + +Warning: exif_imagetype() expects parameter 1 to be string, array given in %s on line %d +NULL +-- Iteration 13 -- + +Warning: exif_imagetype() expects parameter 1 to be string, array given in %s on line %d +NULL +-- Iteration 14 -- + +Warning: exif_imagetype() expects parameter 1 to be string, array given in %s on line %d +NULL +-- Iteration 15 -- + +Warning: exif_imagetype(1): failed to open stream: No such file or directory in %s on line %d +bool(false) +-- Iteration 16 -- + +Warning: exif_imagetype(): Filename cannot be empty in %s on line %d +bool(false) +-- Iteration 17 -- + +Warning: exif_imagetype(1): failed to open stream: No such file or directory in %s on line %d +bool(false) +-- Iteration 18 -- + +Warning: exif_imagetype(): Filename cannot be empty in %s on line %d +bool(false) +-- Iteration 19 -- + +Warning: exif_imagetype(): Filename cannot be empty in %s on line %d +bool(false) +-- Iteration 20 -- + +Warning: exif_imagetype(): Filename cannot be empty in %s on line %d +bool(false) +-- Iteration 21 -- + +Warning: exif_imagetype(): Filename cannot be empty in %s on line %d +bool(false) +-- Iteration 22 -- + +Warning: exif_imagetype(): Filename cannot be empty in %s on line %d +bool(false) +-- Iteration 23 -- + +Warning: exif_imagetype(obj'ct): failed to open stream: No such file or directory in %s on line %d +bool(false) +-- Iteration 24 -- + +Warning: exif_imagetype() expects parameter 1 to be string, resource given in %s on line %d +NULL +-- Iteration 25 -- + +Warning: exif_imagetype(): Filename cannot be empty in %s on line %d +bool(false) +-- Iteration 26 -- + +Warning: exif_imagetype(): Filename cannot be empty in %s on line %d +bool(false) +Done + +?> +===Done=== diff --git a/ext/exif/tests/exif_read_exif_data_basic.phpt b/ext/exif/tests/exif_read_exif_data_basic.phpt new file mode 100644 index 0000000..435f137 --- /dev/null +++ b/ext/exif/tests/exif_read_exif_data_basic.phpt @@ -0,0 +1,62 @@ +--TEST-- +Check for read_exif_data default behaviour +--SKIPIF-- +<?php if (!extension_loaded('exif')) print 'skip exif extension not available';?> +--INI-- +output_handler= +zlib.output_compression=0 +--FILE-- +<?php + +/* Prototype : array read_exif_data ( string $filename [, string $sections [, bool $arrays [, bool $thumbnail ]]] ) + * Description: Alias of exif_read_data() + * Source code: ext/exif/exif.c +*/ +echo "*** Testing read_exif_data() : basic functionality ***\n"; + +print_r(read_exif_data(dirname(__FILE__).'/test2.jpg')); +?> +===Done=== +--EXPECTF-- +*** Testing read_exif_data() : basic functionality *** +Array +( + [FileName] => test2.jpg + [FileDateTime] => %d + [FileSize] => 1240 + [FileType] => 2 + [MimeType] => image/jpeg + [SectionsFound] => ANY_TAG, IFD0, THUMBNAIL, COMMENT + [COMPUTED] => Array + ( + [html] => width="1" height="1" + [Height] => 1 + [Width] => 1 + [IsColor] => 1 + [ByteOrderMotorola] => 1 + [UserComment] => Exif test image. + [UserCommentEncoding] => ASCII + [Copyright] => Photo (c) M.Boerger, Edited by M.Boerger. + [Copyright.Photographer] => Photo (c) M.Boerger + [Copyright.Editor] => Edited by M.Boerger. + [Thumbnail.FileType] => 2 + [Thumbnail.MimeType] => image/jpeg + ) + + [Copyright] => Photo (c) M.Boerger + [UserComment] => ASCII + [THUMBNAIL] => Array + ( + [JPEGInterchangeFormat] => 134 + [JPEGInterchangeFormatLength] => 523 + ) + + [COMMENT] => Array + ( + [0] => Comment #1. + [1] => Comment #2. + [2] => Comment #3end + ) + +) +===Done===
\ No newline at end of file diff --git a/ext/exif/tests/exif_tagname_basic.phpt b/ext/exif/tests/exif_tagname_basic.phpt new file mode 100644 index 0000000..e336011 --- /dev/null +++ b/ext/exif/tests/exif_tagname_basic.phpt @@ -0,0 +1,29 @@ +--TEST-- +Test exif_tagname() function : basic functionality +--SKIPIF-- +<?php if (!extension_loaded('exif')) print 'skip exif extension not available';?> +--INI-- +output_handler= +zlib.output_compression=0 +--FILE-- +<?php + +/* Prototype :string exif_tagname ( string $index ) + * Description: Get the header name for an index + * Source code: ext/exif/exif.c +*/ + +echo "*** Testing exif_tagname() : basic functionality ***\n"; + +var_dump(exif_tagname(0x10E)); +var_dump(exif_tagname(0x10F)); +var_dump(exif_tagname(0x110)); + +?> +===Done=== +--EXPECT-- +*** Testing exif_tagname() : basic functionality *** +string(16) "ImageDescription" +string(4) "Make" +string(5) "Model" +===Done=== diff --git a/ext/exif/tests/exif_tagname_error.phpt b/ext/exif/tests/exif_tagname_error.phpt new file mode 100644 index 0000000..ed1f2fd --- /dev/null +++ b/ext/exif/tests/exif_tagname_error.phpt @@ -0,0 +1,37 @@ +--TEST-- +Test exif_tagname() function : error conditions +--SKIPIF-- +<?php if (!extension_loaded('exif')) print 'skip exif extension not available';?> +--FILE-- +<?php + +/* Prototype :string exif_tagname ( string $index ) + * Description: Get the header name for an index + * Source code: ext/exif/exif.c +*/ + +echo "*** Testing exif_tagname() : error conditions ***\n"; + +echo "\n-- Testing exif_tagname() function with no arguments --\n"; +var_dump( exif_tagname() ); + +echo "\n-- Testing exif_tagname() function with more than expected no. of arguments --\n"; +$extra_arg = 10; +var_dump( exif_tagname(0x10E, $extra_arg) ); + +?> +===Done=== +--EXPECTF-- +*** Testing exif_tagname() : error conditions *** + +-- Testing exif_tagname() function with no arguments -- + +Warning: exif_tagname() expects exactly 1 parameter, 0 given in %s on line %d +NULL + +-- Testing exif_tagname() function with more than expected no. of arguments -- + +Warning: exif_tagname() expects exactly 1 parameter, 2 given in %s on line %d +NULL +===Done=== + diff --git a/ext/exif/tests/exif_tagname_variation1.phpt b/ext/exif/tests/exif_tagname_variation1.phpt new file mode 100644 index 0000000..da89919 --- /dev/null +++ b/ext/exif/tests/exif_tagname_variation1.phpt @@ -0,0 +1,181 @@ +--TEST-- +Test exif_tagname() function : usage variations - different types for index argument +--SKIPIF-- +<?php if (!extension_loaded('exif')) print 'skip exif extension not available';?> +--FILE-- +<?php + +/* Prototype : string exif_tagname ( string $index ) + * Description: Get the header name for an index + * Source code: ext/exif/exif.c +*/ + +echo "*** Testing exif_tagname() : different types for index argument ***\n"; +// initialize all required variables + +// get an unset variable +$unset_var = 'string_val'; +unset($unset_var); + +// declaring a class +class sample { + public function __toString() { + return "obj'ct"; + } +} + +// Defining resource +$file_handle = fopen(__FILE__, 'r'); + +// array with different values +$values = array ( + + // integer values + 0, + 1, + 12345, + -2345, + + // float values + 10.5, + -10.5, + 10.1234567e10, + 10.7654321E-10, + .5, + + // array values + array(), + array(0), + array(1), + array(1, 2), + array('color' => 'red', 'item' => 'pen'), + + // boolean values + true, + false, + TRUE, + FALSE, + + // empty string + "", + '', + + // undefined variable + $undefined_var, + + // unset variable + $unset_var, + + // objects + new sample(), + + // resource + $file_handle, + + NULL, + null +); + + +// loop through each element of the array and check the working of exif_tagname() +// when $index arugment is supplied with different values + +echo "\n--- Testing exif_tagname() by supplying different values for 'index' argument ---\n"; +$counter = 1; +foreach($values as $index) { + echo "-- Iteration $counter --\n"; + var_dump( exif_tagname($index) ); + $counter ++; +} + +// closing the file +fclose($file_handle); + +echo "Done\n"; +?> + +?> +===Done=== +--EXPECTF-- +*** Testing exif_tagname() : different types for index argument *** + +Notice: Undefined variable: undefined_var in %s on line %d + +Notice: Undefined variable: unset_var in %s on line %d + +--- Testing exif_tagname() by supplying different values for 'index' argument --- +-- Iteration 1 -- +bool(false) +-- Iteration 2 -- +bool(false) +-- Iteration 3 -- +bool(false) +-- Iteration 4 -- +bool(false) +-- Iteration 5 -- +bool(false) +-- Iteration 6 -- +bool(false) +-- Iteration 7 -- +bool(false) +-- Iteration 8 -- +bool(false) +-- Iteration 9 -- +bool(false) +-- Iteration 10 -- + +Warning: exif_tagname() expects parameter 1 to be long, array given in %s on line %d +NULL +-- Iteration 11 -- + +Warning: exif_tagname() expects parameter 1 to be long, array given in %s on line %d +NULL +-- Iteration 12 -- + +Warning: exif_tagname() expects parameter 1 to be long, array given in %s on line %d +NULL +-- Iteration 13 -- + +Warning: exif_tagname() expects parameter 1 to be long, array given in %s on line %d +NULL +-- Iteration 14 -- + +Warning: exif_tagname() expects parameter 1 to be long, array given in %s on line %d +NULL +-- Iteration 15 -- +bool(false) +-- Iteration 16 -- +bool(false) +-- Iteration 17 -- +bool(false) +-- Iteration 18 -- +bool(false) +-- Iteration 19 -- + +Warning: exif_tagname() expects parameter 1 to be long, string given in %s on line %d +NULL +-- Iteration 20 -- + +Warning: exif_tagname() expects parameter 1 to be long, string given in %s on line %d +NULL +-- Iteration 21 -- +bool(false) +-- Iteration 22 -- +bool(false) +-- Iteration 23 -- + +Warning: exif_tagname() expects parameter 1 to be long, object given in %s on line %d +NULL +-- Iteration 24 -- + +Warning: exif_tagname() expects parameter 1 to be long, resource given in %s on line %d +NULL +-- Iteration 25 -- +bool(false) +-- Iteration 26 -- +bool(false) +Done + +?> +===Done=== + diff --git a/ext/exif/tests/image007.jpg b/ext/exif/tests/image007.jpg Binary files differnew file mode 100644 index 0000000..8526540 --- /dev/null +++ b/ext/exif/tests/image007.jpg diff --git a/ext/exif/tests/image008.jpg b/ext/exif/tests/image008.jpg Binary files differnew file mode 100644 index 0000000..3e8bfe4 --- /dev/null +++ b/ext/exif/tests/image008.jpg diff --git a/ext/exif/tests/image009.jpg b/ext/exif/tests/image009.jpg Binary files differnew file mode 100644 index 0000000..8803ddc --- /dev/null +++ b/ext/exif/tests/image009.jpg diff --git a/ext/exif/tests/image010.jpg b/ext/exif/tests/image010.jpg Binary files differnew file mode 100644 index 0000000..31ed6d6 --- /dev/null +++ b/ext/exif/tests/image010.jpg diff --git a/ext/exif/tests/image011.jpg b/ext/exif/tests/image011.jpg Binary files differnew file mode 100644 index 0000000..fcd5783 --- /dev/null +++ b/ext/exif/tests/image011.jpg diff --git a/ext/exif/tests/image012.jpg b/ext/exif/tests/image012.jpg Binary files differnew file mode 100644 index 0000000..dd25e06 --- /dev/null +++ b/ext/exif/tests/image012.jpg diff --git a/ext/exif/tests/image013.jpg b/ext/exif/tests/image013.jpg Binary files differnew file mode 100644 index 0000000..93ded26 --- /dev/null +++ b/ext/exif/tests/image013.jpg diff --git a/ext/exif/tests/image014.jpg b/ext/exif/tests/image014.jpg Binary files differnew file mode 100644 index 0000000..7657a0a --- /dev/null +++ b/ext/exif/tests/image014.jpg diff --git a/ext/exif/tests/image015.jpg b/ext/exif/tests/image015.jpg Binary files differnew file mode 100644 index 0000000..6f52dec --- /dev/null +++ b/ext/exif/tests/image015.jpg diff --git a/ext/exif/tests/image016.tiff b/ext/exif/tests/image016.tiff Binary files differnew file mode 100644 index 0000000..1712113 --- /dev/null +++ b/ext/exif/tests/image016.tiff diff --git a/ext/exif/tests/image017.tiff b/ext/exif/tests/image017.tiff Binary files differnew file mode 100644 index 0000000..89800d8 --- /dev/null +++ b/ext/exif/tests/image017.tiff diff --git a/ext/exif/tests/image018.tiff b/ext/exif/tests/image018.tiff Binary files differnew file mode 100644 index 0000000..6b4492f --- /dev/null +++ b/ext/exif/tests/image018.tiff diff --git a/ext/exif/tests/image020.tiff b/ext/exif/tests/image020.tiff Binary files differnew file mode 100644 index 0000000..87f1878 --- /dev/null +++ b/ext/exif/tests/image020.tiff diff --git a/ext/exif/tests/image021.tiff b/ext/exif/tests/image021.tiff Binary files differnew file mode 100644 index 0000000..190f30b --- /dev/null +++ b/ext/exif/tests/image021.tiff diff --git a/ext/exif/tests/image022.tiff b/ext/exif/tests/image022.tiff Binary files differnew file mode 100644 index 0000000..88f4373 --- /dev/null +++ b/ext/exif/tests/image022.tiff diff --git a/ext/exif/tests/image023.tiff b/ext/exif/tests/image023.tiff Binary files differnew file mode 100644 index 0000000..dc33f6e --- /dev/null +++ b/ext/exif/tests/image023.tiff diff --git a/ext/exif/tests/image024.jpg b/ext/exif/tests/image024.jpg Binary files differnew file mode 100644 index 0000000..0b5a42e --- /dev/null +++ b/ext/exif/tests/image024.jpg diff --git a/ext/exif/tests/image025.jpg b/ext/exif/tests/image025.jpg Binary files differnew file mode 100644 index 0000000..a5c0e17 --- /dev/null +++ b/ext/exif/tests/image025.jpg diff --git a/ext/exif/tests/image026.tiff b/ext/exif/tests/image026.tiff Binary files differnew file mode 100644 index 0000000..8fdafc7 --- /dev/null +++ b/ext/exif/tests/image026.tiff diff --git a/ext/exif/tests/image027.tiff b/ext/exif/tests/image027.tiff Binary files differnew file mode 100644 index 0000000..7c3a37a --- /dev/null +++ b/ext/exif/tests/image027.tiff diff --git a/ext/exif/tests/test1.jpg b/ext/exif/tests/test1.jpg Binary files differnew file mode 100644 index 0000000..121decb --- /dev/null +++ b/ext/exif/tests/test1.jpg diff --git a/ext/exif/tests/test2.jpg b/ext/exif/tests/test2.jpg Binary files differnew file mode 100644 index 0000000..f60ecde --- /dev/null +++ b/ext/exif/tests/test2.jpg diff --git a/ext/exif/tests/test3.jpg b/ext/exif/tests/test3.jpg Binary files differnew file mode 100644 index 0000000..7547a16 --- /dev/null +++ b/ext/exif/tests/test3.jpg diff --git a/ext/exif/tests/test4.jpg b/ext/exif/tests/test4.jpg Binary files differnew file mode 100644 index 0000000..8a23a7b --- /dev/null +++ b/ext/exif/tests/test4.jpg diff --git a/ext/exif/tests/test5.jpg b/ext/exif/tests/test5.jpg Binary files differnew file mode 100644 index 0000000..d03cac1 --- /dev/null +++ b/ext/exif/tests/test5.jpg diff --git a/ext/exif/tests/test6.jpg b/ext/exif/tests/test6.jpg Binary files differnew file mode 100644 index 0000000..073cefd --- /dev/null +++ b/ext/exif/tests/test6.jpg |