Lines Matching refs:ImageInfo

302 #define EXIF_ERRLOG_FILEEOF(ImageInfo)    exif_error_docref(NULL EXIFERR_CC, ImageInfo, E_WARNING, …  argument
303 #define EXIF_ERRLOG_CORRUPT(ImageInfo) exif_error_docref(NULL EXIFERR_CC, ImageInfo, E_WARNING, … argument
304 #define EXIF_ERRLOG_THUMBEOF(ImageInfo) exif_error_docref(NULL EXIFERR_CC, ImageInfo, E_WARNING, … argument
305 #define EXIF_ERRLOG_FSREALLOC(ImageInfo) exif_error_docref(NULL EXIFERR_CC, ImageInfo, E_WARNING, … argument
1564 static void exif_error_docref(const char *docref EXIFERR_DC, const image_info_type *ImageInfo, int … in exif_error_docref() argument
1574 php_verror(docref, ImageInfo->FileName?ImageInfo->FileName:"", type, buf, args TSRMLS_CC); in exif_error_docref()
1578 php_verror(docref, ImageInfo->FileName?ImageInfo->FileName:"", type, format, args TSRMLS_CC); in exif_error_docref()
1598 static int exif_file_sections_add(image_info_type *ImageInfo, int type, size_t size, uchar *data) in exif_file_sections_add() argument
1601 int count = ImageInfo->file.count; in exif_file_sections_add()
1603 tmp = safe_erealloc(ImageInfo->file.list, (count+1), sizeof(file_section), 0); in exif_file_sections_add()
1604 ImageInfo->file.list = tmp; in exif_file_sections_add()
1605 ImageInfo->file.list[count].type = 0xFFFF; in exif_file_sections_add()
1606 ImageInfo->file.list[count].data = NULL; in exif_file_sections_add()
1607 ImageInfo->file.list[count].size = 0; in exif_file_sections_add()
1608 ImageInfo->file.count = count+1; in exif_file_sections_add()
1614 ImageInfo->file.list[count].type = type; in exif_file_sections_add()
1615 ImageInfo->file.list[count].data = data; in exif_file_sections_add()
1616 ImageInfo->file.list[count].size = size; in exif_file_sections_add()
1624 static int exif_file_sections_realloc(image_info_type *ImageInfo, int section_index, size_t size TS… in exif_file_sections_realloc() argument
1631 if (section_index >= ImageInfo->file.count) { in exif_file_sections_realloc()
1632 EXIF_ERRLOG_FSREALLOC(ImageInfo) in exif_file_sections_realloc()
1635 tmp = safe_erealloc(ImageInfo->file.list[section_index].data, 1, size, 0); in exif_file_sections_realloc()
1636 ImageInfo->file.list[section_index].data = tmp; in exif_file_sections_realloc()
1637 ImageInfo->file.list[section_index].size = size; in exif_file_sections_realloc()
1645 static int exif_file_sections_free(image_info_type *ImageInfo) in exif_file_sections_free() argument
1649 if (ImageInfo->file.count) { in exif_file_sections_free()
1650 for (i=0; i<ImageInfo->file.count; i++) { in exif_file_sections_free()
1651 EFREE_IF(ImageInfo->file.list[i].data); in exif_file_sections_free()
1654 EFREE_IF(ImageInfo->file.list); in exif_file_sections_free()
1655 ImageInfo->file.count = 0; in exif_file_sections_free()
2283 static int exif_process_IFD_in_JPEG(image_info_type *ImageInfo, char *dir_start, char *offset_base,…
2284 static int exif_process_IFD_TAG( image_info_type *ImageInfo, char *dir_entry, char *offset_base,…
2439 static void exif_thumbnail_build(image_info_type *ImageInfo TSRMLS_DC) { in exif_thumbnail_build()
2450 if (!ImageInfo->read_thumbnail || !ImageInfo->Thumbnail.offset || !ImageInfo->Thumbnail.size) { in exif_thumbnail_build()
2454 …exif_error_docref(NULL EXIFERR_CC, ImageInfo, E_NOTICE, "Thumbnail: filetype = %d", ImageInfo->Thu… in exif_thumbnail_build()
2456 switch(ImageInfo->Thumbnail.filetype) { in exif_thumbnail_build()
2463 info_list = &ImageInfo->info_list[SECTION_THUMBNAIL]; in exif_thumbnail_build()
2466 …exif_error_docref(NULL EXIFERR_CC, ImageInfo, E_NOTICE, "Thumbnail: size of signature + directory(… in exif_thumbnail_build()
2477 new_data = safe_erealloc(ImageInfo->Thumbnail.data, 1, ImageInfo->Thumbnail.size, new_size); in exif_thumbnail_build()
2478 ImageInfo->Thumbnail.data = new_data; in exif_thumbnail_build()
2479 …memmove(ImageInfo->Thumbnail.data + new_move, ImageInfo->Thumbnail.data, ImageInfo->Thumbnail.size… in exif_thumbnail_build()
2480 ImageInfo->Thumbnail.size += new_size; in exif_thumbnail_build()
2482 if (ImageInfo->motorola_intel) { in exif_thumbnail_build()
2488 php_ifd_set16u(new_data, info_list->count, ImageInfo->motorola_intel); in exif_thumbnail_build()
2494 …exif_error_docref(NULL EXIFERR_CC, ImageInfo, E_NOTICE, "Thumbnail: process tag(x%04X=%s): %s%s (%… in exif_thumbnail_build()
2497 php_ifd_set16u(new_data + 0, info_data->tag, ImageInfo->motorola_intel); in exif_thumbnail_build()
2498 php_ifd_set16u(new_data + 2, TAG_FMT_ULONG, ImageInfo->motorola_intel); in exif_thumbnail_build()
2499 php_ifd_set32u(new_data + 4, 1, ImageInfo->motorola_intel); in exif_thumbnail_build()
2500 php_ifd_set32u(new_data + 8, new_move, ImageInfo->motorola_intel); in exif_thumbnail_build()
2502 php_ifd_set16u(new_data + 0, info_data->tag, ImageInfo->motorola_intel); in exif_thumbnail_build()
2503 php_ifd_set16u(new_data + 2, info_data->format, ImageInfo->motorola_intel); in exif_thumbnail_build()
2504 php_ifd_set32u(new_data + 4, info_data->length, ImageInfo->motorola_intel); in exif_thumbnail_build()
2505 value_ptr = exif_ifd_make_value(info_data, ImageInfo->motorola_intel TSRMLS_CC); in exif_thumbnail_build()
2509 php_ifd_set32u(new_data+8, new_value, ImageInfo->motorola_intel); in exif_thumbnail_build()
2511 …exif_error_docref(NULL EXIFERR_CC, ImageInfo, E_NOTICE, "Thumbnail: writing with value offset: 0x%… in exif_thumbnail_build()
2513 memmove(ImageInfo->Thumbnail.data+new_value, value_ptr, byte_count); in exif_thumbnail_build()
2522 exif_error_docref(NULL EXIFERR_CC, ImageInfo, E_NOTICE, "Thumbnail: created"); in exif_thumbnail_build()
2531 static void exif_thumbnail_extract(image_info_type *ImageInfo, char *offset, size_t length TSRMLS_D… in exif_thumbnail_extract() argument
2532 if (ImageInfo->Thumbnail.data) { in exif_thumbnail_extract()
2533 …exif_error_docref("exif_read_data#error_mult_thumb" EXIFERR_CC, ImageInfo, E_WARNING, "Multiple po… in exif_thumbnail_extract()
2536 if (!ImageInfo->read_thumbnail) { in exif_thumbnail_extract()
2540 if (ImageInfo->Thumbnail.size >= 65536 in exif_thumbnail_extract()
2541 || ImageInfo->Thumbnail.size <= 0 in exif_thumbnail_extract()
2542 || ImageInfo->Thumbnail.offset <= 0 in exif_thumbnail_extract()
2544 exif_error_docref(NULL EXIFERR_CC, ImageInfo, E_WARNING, "Illegal thumbnail size/offset"); in exif_thumbnail_extract()
2548 if (ImageInfo->Thumbnail.size > length in exif_thumbnail_extract()
2549 || (ImageInfo->Thumbnail.offset + ImageInfo->Thumbnail.size) > length in exif_thumbnail_extract()
2550 || ImageInfo->Thumbnail.offset > length - ImageInfo->Thumbnail.size in exif_thumbnail_extract()
2552 EXIF_ERRLOG_THUMBEOF(ImageInfo) in exif_thumbnail_extract()
2555ImageInfo->Thumbnail.data = estrndup(offset + ImageInfo->Thumbnail.offset, ImageInfo->Thumbnail.si… in exif_thumbnail_extract()
2556 exif_thumbnail_build(ImageInfo TSRMLS_CC); in exif_thumbnail_extract()
2614 static int exif_process_user_comment(image_info_type *ImageInfo, char **pszInfoPtr, char **pszEncod… in exif_process_user_comment() argument
2639 } else if (ImageInfo->motorola_intel) { in exif_process_user_comment()
2640 decode = ImageInfo->decode_unicode_be; in exif_process_user_comment()
2642 decode = ImageInfo->decode_unicode_le; in exif_process_user_comment()
2644 to = zend_multibyte_fetch_encoding(ImageInfo->encode_unicode TSRMLS_CC); in exif_process_user_comment()
2668 to = zend_multibyte_fetch_encoding(ImageInfo->encode_jis TSRMLS_CC); in exif_process_user_comment()
2669 …from = zend_multibyte_fetch_encoding(ImageInfo->motorola_intel ? ImageInfo->decode_jis_be : ImageI… in exif_process_user_comment()
2704 static int exif_process_unicode(image_info_type *ImageInfo, xp_field_type *xp_field, int tag, char … in exif_process_unicode() argument
2714 zend_multibyte_fetch_encoding(ImageInfo->encode_unicode TSRMLS_CC), in exif_process_unicode()
2715 …zend_multibyte_fetch_encoding(ImageInfo->motorola_intel ? ImageInfo->decode_unicode_be : ImageInfo in exif_process_unicode()
2725 static int exif_process_IFD_in_MAKERNOTE(image_info_type *ImageInfo, char * value_ptr, int value_le… in exif_process_IFD_in_MAKERNOTE() argument
2736 …(NULL EXIFERR_CC, ImageInfo, E_NOTICE, "No maker note data found. Detected maker: %s (length = %d)… in exif_process_IFD_in_MAKERNOTE()
2745 if (maker_note->make && (!ImageInfo->make || strcmp(maker_note->make, ImageInfo->make))) in exif_process_IFD_in_MAKERNOTE()
2747 if (maker_note->model && (!ImageInfo->model || strcmp(maker_note->model, ImageInfo->model))) in exif_process_IFD_in_MAKERNOTE()
2756 …exif_error_docref("exif_read_data#error_ifd" EXIFERR_CC, ImageInfo, E_WARNING, "IFD data too short… in exif_process_IFD_in_MAKERNOTE()
2763 …exif_error_docref(NULL EXIFERR_CC, ImageInfo, E_NOTICE, "Process %s @x%04X + 0x%04X=%d: %s", exif_… in exif_process_IFD_in_MAKERNOTE()
2766 ImageInfo->sections_found |= FOUND_MAKERNOTE; in exif_process_IFD_in_MAKERNOTE()
2768 old_motorola_intel = ImageInfo->motorola_intel; in exif_process_IFD_in_MAKERNOTE()
2771 ImageInfo->motorola_intel = 0; in exif_process_IFD_in_MAKERNOTE()
2774 ImageInfo->motorola_intel = 1; in exif_process_IFD_in_MAKERNOTE()
2781 NumDirEntries = php_ifd_get16u(dir_start, ImageInfo->motorola_intel); in exif_process_IFD_in_MAKERNOTE()
2791 …exif_error_docref("exif_read_data#error_ifd" EXIFERR_CC, ImageInfo, E_WARNING, "IFD data too short… in exif_process_IFD_in_MAKERNOTE()
2794 offset_diff = 2 + NumDirEntries*12 + 4 - php_ifd_get32u(dir_start+10, ImageInfo->motorola_intel); in exif_process_IFD_in_MAKERNOTE()
2796 …exif_error_docref(NULL EXIFERR_CC, ImageInfo, E_NOTICE, "Using automatic offset correction: 0x%04X… in exif_process_IFD_in_MAKERNOTE()
2799 …exif_error_docref("exif_read_data#error_ifd" EXIFERR_CC, ImageInfo, E_WARNING, "IFD data bad offse… in exif_process_IFD_in_MAKERNOTE()
2811 …exif_error_docref("exif_read_data#error_ifd" EXIFERR_CC, ImageInfo, E_WARNING, "Illegal IFD size: … in exif_process_IFD_in_MAKERNOTE()
2816 if (!exif_process_IFD_TAG(ImageInfo, dir_start + 2 + 12 * de, in exif_process_IFD_in_MAKERNOTE()
2821 ImageInfo->motorola_intel = old_motorola_intel; in exif_process_IFD_in_MAKERNOTE()
2824 …exif_error_docref(NULL EXIFERR_CC, ImageInfo, E_NOTICE, "Subsection %s done", exif_get_sectionname… in exif_process_IFD_in_MAKERNOTE()
2832 static int exif_process_IFD_TAG(image_info_type *ImageInfo, char *dir_entry, char *offset_base, siz… in exif_process_IFD_TAG() argument
2846 if (ImageInfo->ifd_nesting_level > MAX_IFD_NESTING_LEVEL) { in exif_process_IFD_TAG()
2847 …exif_error_docref("exif_read_data#error_ifd" EXIFERR_CC, ImageInfo, E_WARNING, "corrupt EXIF heade… in exif_process_IFD_TAG()
2850 ImageInfo->ifd_nesting_level++; in exif_process_IFD_TAG()
2852 tag = php_ifd_get16u(dir_entry, ImageInfo->motorola_intel); in exif_process_IFD_TAG()
2853 format = php_ifd_get16u(dir_entry+2, ImageInfo->motorola_intel); in exif_process_IFD_TAG()
2854 components = php_ifd_get32u(dir_entry+4, ImageInfo->motorola_intel); in exif_process_IFD_TAG()
2858 …exif_error_docref("exif_read_data#error_ifd" EXIFERR_CC, ImageInfo, E_WARNING, "Process tag(x%04X=… in exif_process_IFD_TAG()
2864 …exif_error_docref("exif_read_data#error_ifd" EXIFERR_CC, ImageInfo, E_WARNING, "Process tag(x%04X=… in exif_process_IFD_TAG()
2871 …exif_error_docref("exif_read_data#error_ifd" EXIFERR_CC, ImageInfo, E_WARNING, "Process tag(x%04X=… in exif_process_IFD_TAG()
2878 offset_val = php_ifd_get32u(dir_entry+8, ImageInfo->motorola_intel); in exif_process_IFD_TAG()
2890ImageInfo->FileSize || offset_val>ImageInfo->FileSize-byte_count || (ImageInfo->FileType!=IMAGE_FI… in exif_process_IFD_TAG()
2894 …exif_error_docref("exif_read_data#error_ifd" EXIFERR_CC, ImageInfo, E_WARNING, "Process tag(x%04X=… in exif_process_IFD_TAG()
2898 …exif_error_docref("exif_read_data#error_ifd" EXIFERR_CC, ImageInfo, E_WARNING, "Process tag(x%04X=… in exif_process_IFD_TAG()
2916 fpos = php_stream_tell(ImageInfo->infile); in exif_process_IFD_TAG()
2917 php_stream_seek(ImageInfo->infile, displacement+offset_val, SEEK_SET); in exif_process_IFD_TAG()
2918 fgot = php_stream_tell(ImageInfo->infile); in exif_process_IFD_TAG()
2921 …exif_error_docref(NULL EXIFERR_CC, ImageInfo, E_WARNING, "Wrong file pointer: 0x%08X != 0x%08X", f… in exif_process_IFD_TAG()
2924 fgot = php_stream_read(ImageInfo->infile, value_ptr, byte_count); in exif_process_IFD_TAG()
2925 php_stream_seek(ImageInfo->infile, fpos, SEEK_SET); in exif_process_IFD_TAG()
2928 EXIF_ERRLOG_FILEEOF(ImageInfo) in exif_process_IFD_TAG()
2938 ImageInfo->sections_found |= FOUND_ANY_TAG; in exif_process_IFD_TAG()
2940 …dump_data = exif_dump_data(&dump_free, format, components, length, ImageInfo->motorola_intel, valu… in exif_process_IFD_TAG()
2941 …exif_error_docref(NULL EXIFERR_CC, ImageInfo, E_NOTICE, "Process tag(x%04X=%s,@x%04X + x%04X(=%d))… in exif_process_IFD_TAG()
2948 if (!ImageInfo->Thumbnail.data) { in exif_process_IFD_TAG()
2952ImageInfo->Thumbnail.width = exif_convert_any_to_int(value_ptr, format, ImageInfo->motorola_intel … in exif_process_IFD_TAG()
2957ImageInfo->Thumbnail.height = exif_convert_any_to_int(value_ptr, format, ImageInfo->motorola_intel… in exif_process_IFD_TAG()
2963ImageInfo->Thumbnail.offset = exif_convert_any_to_int(value_ptr, format, ImageInfo->motorola_intel… in exif_process_IFD_TAG()
2967 …if (ImageInfo->FileType == IMAGE_FILETYPE_TIFF_II || ImageInfo->FileType == IMAGE_FILETYPE_TIFF_MM… in exif_process_IFD_TAG()
2968 ImageInfo->Thumbnail.filetype = ImageInfo->FileType; in exif_process_IFD_TAG()
2971 ImageInfo->Thumbnail.filetype = IMAGE_FILETYPE_TIFF_MM; in exif_process_IFD_TAG()
2973ImageInfo->Thumbnail.size = exif_convert_any_to_int(value_ptr, format, ImageInfo->motorola_intel T… in exif_process_IFD_TAG()
2977 if (ImageInfo->Thumbnail.filetype == IMAGE_FILETYPE_UNKNOWN) { in exif_process_IFD_TAG()
2978 ImageInfo->Thumbnail.filetype = IMAGE_FILETYPE_JPEG; in exif_process_IFD_TAG()
2979ImageInfo->Thumbnail.size = exif_convert_any_to_int(value_ptr, format, ImageInfo->motorola_intel T… in exif_process_IFD_TAG()
2992 ImageInfo->CopyrightPhotographer = estrdup(value_ptr); in exif_process_IFD_TAG()
2993 ImageInfo->CopyrightEditor = estrndup(value_ptr+length+1, byte_count-length-1); in exif_process_IFD_TAG()
2994 …spprintf(&ImageInfo->Copyright, 0, "%s, %s", ImageInfo->CopyrightPhotographer, ImageInfo->Copyrigh… in exif_process_IFD_TAG()
2999 ImageInfo->Copyright = estrndup(value_ptr, byte_count); in exif_process_IFD_TAG()
3005ImageInfo->UserCommentLength = exif_process_user_comment(ImageInfo, &(ImageInfo->UserComment), &(I… in exif_process_IFD_TAG()
3013 …tmp_xp = (xp_field_type*)safe_erealloc(ImageInfo->xp_fields.list, (ImageInfo->xp_fields.count+1), … in exif_process_IFD_TAG()
3014 ImageInfo->sections_found |= FOUND_WINXP; in exif_process_IFD_TAG()
3015 ImageInfo->xp_fields.list = tmp_xp; in exif_process_IFD_TAG()
3016 ImageInfo->xp_fields.count++; in exif_process_IFD_TAG()
3017 …exif_process_unicode(ImageInfo, &(ImageInfo->xp_fields.list[ImageInfo->xp_fields.count-1]), tag, v… in exif_process_IFD_TAG()
3023ImageInfo->ApertureFNumber = (float)exif_convert_any_format(value_ptr, format, ImageInfo->motorola… in exif_process_IFD_TAG()
3030 if (ImageInfo->ApertureFNumber == 0) { in exif_process_IFD_TAG()
3031 ImageInfo->ApertureFNumber in exif_process_IFD_TAG()
3032 …= (float)exp(exif_convert_any_format(value_ptr, format, ImageInfo->motorola_intel TSRMLS_CC)*log(2… in exif_process_IFD_TAG()
3041 if (ImageInfo->ExposureTime == 0) { in exif_process_IFD_TAG()
3042 ImageInfo->ExposureTime in exif_process_IFD_TAG()
3043 …= (float)(1/exp(exif_convert_any_format(value_ptr, format, ImageInfo->motorola_intel TSRMLS_CC)*lo… in exif_process_IFD_TAG()
3047 ImageInfo->ExposureTime = -1; in exif_process_IFD_TAG()
3051ImageInfo->ExifImageWidth = exif_convert_any_to_int(value_ptr, format, ImageInfo->motorola_intel T… in exif_process_IFD_TAG()
3055ImageInfo->FocalplaneXRes = exif_convert_any_format(value_ptr, format, ImageInfo->motorola_intel T… in exif_process_IFD_TAG()
3061ImageInfo->Distance = (float)exif_convert_any_format(value_ptr, format, ImageInfo->motorola_intel … in exif_process_IFD_TAG()
3065 switch((int)exif_convert_any_format(value_ptr, format, ImageInfo->motorola_intel TSRMLS_CC)) { in exif_process_IFD_TAG()
3066 case 1: ImageInfo->FocalplaneUnits = 25.4; break; /* inch */ in exif_process_IFD_TAG()
3071 ImageInfo->FocalplaneUnits = 25.4; in exif_process_IFD_TAG()
3074 case 3: ImageInfo->FocalplaneUnits = 10; break; /* centimeter */ in exif_process_IFD_TAG()
3075 case 4: ImageInfo->FocalplaneUnits = 1; break; /* milimeter */ in exif_process_IFD_TAG()
3076 case 5: ImageInfo->FocalplaneUnits = .001; break; /* micrometer */ in exif_process_IFD_TAG()
3085 exif_error_docref(NULL EXIFERR_CC, ImageInfo, E_NOTICE, "Skip SUB IFD"); in exif_process_IFD_TAG()
3090 ImageInfo->make = estrndup(value_ptr, byte_count); in exif_process_IFD_TAG()
3093 ImageInfo->model = estrndup(value_ptr, byte_count); in exif_process_IFD_TAG()
3097 …if (!exif_process_IFD_in_MAKERNOTE(ImageInfo, value_ptr, byte_count, offset_base, IFDlength, displ… in exif_process_IFD_TAG()
3112 exif_error_docref(NULL EXIFERR_CC, ImageInfo, E_NOTICE, "Found EXIF"); in exif_process_IFD_TAG()
3114 ImageInfo->sections_found |= FOUND_EXIF; in exif_process_IFD_TAG()
3119 exif_error_docref(NULL EXIFERR_CC, ImageInfo, E_NOTICE, "Found GPS"); in exif_process_IFD_TAG()
3121 ImageInfo->sections_found |= FOUND_GPS; in exif_process_IFD_TAG()
3126 exif_error_docref(NULL EXIFERR_CC, ImageInfo, E_NOTICE, "Found INTEROPERABILITY"); in exif_process_IFD_TAG()
3128 ImageInfo->sections_found |= FOUND_INTEROP; in exif_process_IFD_TAG()
3132 Subdir_start = offset_base + php_ifd_get32u(value_ptr, ImageInfo->motorola_intel); in exif_process_IFD_TAG()
3134 …exif_error_docref("exif_read_data#error_ifd" EXIFERR_CC, ImageInfo, E_WARNING, "Illegal IFD Pointe… in exif_process_IFD_TAG()
3137 …if (!exif_process_IFD_in_JPEG(ImageInfo, Subdir_start, offset_base, IFDlength, displacement, sub_s… in exif_process_IFD_TAG()
3141 …exif_error_docref(NULL EXIFERR_CC, ImageInfo, E_NOTICE, "Subsection %s done", exif_get_sectionname… in exif_process_IFD_TAG()
3146 …exif_iif_add_tag(ImageInfo, section_index, exif_get_tagname(tag, tagname, sizeof(tagname), tag_tab… in exif_process_IFD_TAG()
3154 static int exif_process_IFD_in_JPEG(image_info_type *ImageInfo, char *dir_start, char *offset_base,… in exif_process_IFD_in_JPEG() argument
3161 …exif_error_docref(NULL EXIFERR_CC, ImageInfo, E_NOTICE, "Process %s (x%04X(=%d))", exif_get_sectio… in exif_process_IFD_in_JPEG()
3164 ImageInfo->sections_found |= FOUND_IFD0; in exif_process_IFD_in_JPEG()
3167 …exif_error_docref("exif_read_data#error_ifd" EXIFERR_CC, ImageInfo, E_WARNING, "Illegal IFD size"); in exif_process_IFD_in_JPEG()
3171 NumDirEntries = php_ifd_get16u(dir_start, ImageInfo->motorola_intel); in exif_process_IFD_in_JPEG()
3174 …exif_error_docref("exif_read_data#error_ifd" EXIFERR_CC, ImageInfo, E_WARNING, "Illegal IFD size: … in exif_process_IFD_in_JPEG()
3179 if (!exif_process_IFD_TAG(ImageInfo, dir_start + 2 + 12 * de, in exif_process_IFD_in_JPEG()
3195 …exif_error_docref("exif_read_data#error_ifd" EXIFERR_CC, ImageInfo, E_WARNING, "Illegal IFD size"); in exif_process_IFD_in_JPEG()
3198 NextDirOffset = php_ifd_get32u(dir_start+2+12*de, ImageInfo->motorola_intel); in exif_process_IFD_in_JPEG()
3202 …exif_error_docref("exif_read_data#error_ifd" EXIFERR_CC, ImageInfo, E_WARNING, "Illegal IFD offset… in exif_process_IFD_in_JPEG()
3207 exif_error_docref(NULL EXIFERR_CC, ImageInfo, E_NOTICE, "Expect next IFD to be thumbnail"); in exif_process_IFD_in_JPEG()
3209 …if (exif_process_IFD_in_JPEG(ImageInfo, offset_base + NextDirOffset, offset_base, IFDlength, displ… in exif_process_IFD_in_JPEG()
3211 …exif_error_docref(NULL EXIFERR_CC, ImageInfo, E_NOTICE, "Thumbnail size: 0x%04X", ImageInfo->Thumb… in exif_process_IFD_in_JPEG()
3213 if (ImageInfo->Thumbnail.filetype != IMAGE_FILETYPE_UNKNOWN in exif_process_IFD_in_JPEG()
3214 && ImageInfo->Thumbnail.size in exif_process_IFD_in_JPEG()
3215 && ImageInfo->Thumbnail.offset in exif_process_IFD_in_JPEG()
3216 && ImageInfo->read_thumbnail in exif_process_IFD_in_JPEG()
3218 exif_thumbnail_extract(ImageInfo, offset_base, IFDlength TSRMLS_CC); in exif_process_IFD_in_JPEG()
3232 static void exif_process_TIFF_in_JPEG(image_info_type *ImageInfo, char *CharBuf, size_t length, siz… in exif_process_TIFF_in_JPEG() argument
3238 ImageInfo->motorola_intel = 0; in exif_process_TIFF_in_JPEG()
3240 ImageInfo->motorola_intel = 1; in exif_process_TIFF_in_JPEG()
3242 exif_error_docref(NULL EXIFERR_CC, ImageInfo, E_WARNING, "Invalid TIFF alignment marker"); in exif_process_TIFF_in_JPEG()
3248 exif_error_docref(NULL EXIFERR_CC, ImageInfo, E_WARNING, "Invalid TIFF start (1)"); in exif_process_TIFF_in_JPEG()
3251 exif_value_2a = php_ifd_get16u(CharBuf+2, ImageInfo->motorola_intel); in exif_process_TIFF_in_JPEG()
3252 offset_of_ifd = php_ifd_get32u(CharBuf+4, ImageInfo->motorola_intel); in exif_process_TIFF_in_JPEG()
3254 exif_error_docref(NULL EXIFERR_CC, ImageInfo, E_WARNING, "Invalid TIFF start (1)"); in exif_process_TIFF_in_JPEG()
3258 exif_error_docref(NULL EXIFERR_CC, ImageInfo, E_WARNING, "Invalid IFD start"); in exif_process_TIFF_in_JPEG()
3262 ImageInfo->sections_found |= FOUND_IFD0; in exif_process_TIFF_in_JPEG()
3264 …exif_process_IFD_in_JPEG(ImageInfo, CharBuf+offset_of_ifd, CharBuf, length/*-14*/, displacement, S… in exif_process_TIFF_in_JPEG()
3267 exif_error_docref(NULL EXIFERR_CC, ImageInfo, E_NOTICE, "Process TIFF in JPEG done"); in exif_process_TIFF_in_JPEG()
3271 if (ImageInfo->FocalplaneXRes != 0) { in exif_process_TIFF_in_JPEG()
3272ImageInfo->CCDWidth = (float)(ImageInfo->ExifImageWidth * ImageInfo->FocalplaneUnits / ImageInfo->… in exif_process_TIFF_in_JPEG()
3281 static void exif_process_APP1(image_info_type *ImageInfo, char *CharBuf, size_t length, size_t disp… in exif_process_APP1() argument
3286 exif_error_docref(NULL EXIFERR_CC, ImageInfo, E_WARNING, "Incorrect APP1 Exif Identifier Code"); in exif_process_APP1()
3289 exif_process_TIFF_in_JPEG(ImageInfo, CharBuf + 8, length - 8, displacement+8 TSRMLS_CC); in exif_process_APP1()
3291 exif_error_docref(NULL EXIFERR_CC, ImageInfo, E_NOTICE, "Process APP1/EXIF done"); in exif_process_APP1()
3299 static void exif_process_APP12(image_info_type *ImageInfo, char *buffer, size_t length TSRMLS_DC) in exif_process_APP12() argument
3304 …exif_iif_add_tag(ImageInfo, SECTION_APP12, "Company", TAG_NONE, TAG_FMT_STRING, l1, buffer+2 TSRML… in exif_process_APP12()
3307 …exif_iif_add_tag(ImageInfo, SECTION_APP12, "Info", TAG_NONE, TAG_FMT_STRING, l2, buffer+2+l1+1 TSR… in exif_process_APP12()
3311 …exif_error_docref(NULL EXIFERR_CC, ImageInfo, E_NOTICE, "Process section APP12 with l1=%d, l2=%d d… in exif_process_APP12()
3318 static int exif_scan_JPEG_header(image_info_type *ImageInfo TSRMLS_DC) in exif_scan_JPEG_header()
3329 fpos = php_stream_tell(ImageInfo->infile); in exif_scan_JPEG_header()
3330 …exif_error_docref(NULL EXIFERR_CC, ImageInfo, E_NOTICE, "Needing section %d @ 0x%08X", ImageInfo->… in exif_scan_JPEG_header()
3340 if ((marker = php_stream_getc(ImageInfo->infile)) == EOF) { in exif_scan_JPEG_header()
3341 EXIF_ERRLOG_CORRUPT(ImageInfo) in exif_scan_JPEG_header()
3354 …exif_error_docref("exif_read_data#error_mcom" EXIFERR_CC, ImageInfo, E_NOTICE, "Image has corrupt … in exif_scan_JPEG_header()
3359 fpos = php_stream_tell(ImageInfo->infile); in exif_scan_JPEG_header()
3363 exif_error_docref(NULL EXIFERR_CC, ImageInfo, E_WARNING, "To many padding bytes"); in exif_scan_JPEG_header()
3368 if ((lh = php_stream_getc(ImageInfo->infile)) == EOF) { in exif_scan_JPEG_header()
3369 EXIF_ERRLOG_CORRUPT(ImageInfo) in exif_scan_JPEG_header()
3372 if ((ll = php_stream_getc(ImageInfo->infile)) == EOF) { in exif_scan_JPEG_header()
3373 EXIF_ERRLOG_CORRUPT(ImageInfo) in exif_scan_JPEG_header()
3381 …exif_error_docref(NULL EXIFERR_CC, ImageInfo, E_WARNING, "%s, Section length: 0x%02X%02X", EXIF_ER… in exif_scan_JPEG_header()
3383 EXIF_ERRLOG_CORRUPT(ImageInfo) in exif_scan_JPEG_header()
3388 sn = exif_file_sections_add(ImageInfo, marker, itemlen+1, NULL); in exif_scan_JPEG_header()
3389 Data = ImageInfo->file.list[sn].data; in exif_scan_JPEG_header()
3395 …got = php_stream_read(ImageInfo->infile, (char*)(Data+2), itemlen-2); /* Read the whole section. */ in exif_scan_JPEG_header()
3397 …exif_error_docref(NULL EXIFERR_CC, ImageInfo, E_WARNING, "Error reading from file: got=x%04X(=%d) … in exif_scan_JPEG_header()
3402 …exif_error_docref(NULL EXIFERR_CC, ImageInfo, E_NOTICE, "Process section(x%02X=%s) @ x%04X + x%04X… in exif_scan_JPEG_header()
3407 if (ImageInfo->read_all) { in exif_scan_JPEG_header()
3409 fpos = php_stream_tell(ImageInfo->infile); in exif_scan_JPEG_header()
3410 size = ImageInfo->FileSize - fpos; in exif_scan_JPEG_header()
3411 sn = exif_file_sections_add(ImageInfo, M_PSEUDO, size, NULL); in exif_scan_JPEG_header()
3412 Data = ImageInfo->file.list[sn].data; in exif_scan_JPEG_header()
3413 got = php_stream_read(ImageInfo->infile, (char*)Data, size); in exif_scan_JPEG_header()
3415 EXIF_ERRLOG_FILEEOF(ImageInfo) in exif_scan_JPEG_header()
3422 exif_error_docref(NULL EXIFERR_CC, ImageInfo, E_WARNING, "No image in jpeg!"); in exif_scan_JPEG_header()
3423 return (ImageInfo->sections_found&(~FOUND_COMPUTED)) ? TRUE : FALSE; in exif_scan_JPEG_header()
3426 exif_process_COM(ImageInfo, (char *)Data, itemlen TSRMLS_CC); in exif_scan_JPEG_header()
3430 if (!(ImageInfo->sections_found&FOUND_IFD0)) { in exif_scan_JPEG_header()
3434 exif_process_APP1(ImageInfo, (char *)Data, itemlen, fpos TSRMLS_CC); in exif_scan_JPEG_header()
3439 exif_process_APP12(ImageInfo, (char *)Data, itemlen TSRMLS_CC); in exif_scan_JPEG_header()
3461 ImageInfo->Width = sof_info.width; in exif_scan_JPEG_header()
3462 ImageInfo->Height = sof_info.height; in exif_scan_JPEG_header()
3464 ImageInfo->IsColor = 1; in exif_scan_JPEG_header()
3466 ImageInfo->IsColor = 0; in exif_scan_JPEG_header()
3478 exif_error_docref(NULL EXIFERR_CC, ImageInfo, E_NOTICE, "Done"); in exif_scan_JPEG_header()
3486 static int exif_scan_thumbnail(image_info_type *ImageInfo TSRMLS_DC) in exif_scan_thumbnail()
3488 uchar c, *data = (uchar*)ImageInfo->Thumbnail.data; in exif_scan_thumbnail()
3497 if (!ImageInfo->Thumbnail.width && !ImageInfo->Thumbnail.height) { in exif_scan_thumbnail()
3498 exif_error_docref(NULL EXIFERR_CC, ImageInfo, E_WARNING, "Thumbnail is not a JPEG image"); in exif_scan_thumbnail()
3504 if (pos>=ImageInfo->Thumbnail.size) in exif_scan_thumbnail()
3507 if (pos>=ImageInfo->Thumbnail.size) in exif_scan_thumbnail()
3514 if (pos+3>=ImageInfo->Thumbnail.size) in exif_scan_thumbnail()
3522 if (pos+length>=ImageInfo->Thumbnail.size) { in exif_scan_thumbnail()
3526 …exif_error_docref(NULL EXIFERR_CC, ImageInfo, E_NOTICE, "Thumbnail: process section(x%02X=%s) @ x%… in exif_scan_thumbnail()
3544 ImageInfo->Thumbnail.height = sof_info.height; in exif_scan_thumbnail()
3545 ImageInfo->Thumbnail.width = sof_info.width; in exif_scan_thumbnail()
3547 …exif_error_docref(NULL EXIFERR_CC, ImageInfo, E_NOTICE, "Thumbnail: size: %d * %d", sof_info.width… in exif_scan_thumbnail()
3553 exif_error_docref(NULL EXIFERR_CC, ImageInfo, E_WARNING, "Could not compute size of thumbnail"); in exif_scan_thumbnail()
3563 exif_error_docref(NULL EXIFERR_CC, ImageInfo, E_WARNING, "Could not compute size of thumbnail"); in exif_scan_thumbnail()
3570 static int exif_process_IFD_in_TIFF(image_info_type *ImageInfo, size_t dir_offset, int section_inde… in exif_process_IFD_in_TIFF() argument
3579 if (ImageInfo->ifd_nesting_level > MAX_IFD_NESTING_LEVEL) { in exif_process_IFD_in_TIFF()
3583 if (ImageInfo->FileSize >= dir_offset+2) { in exif_process_IFD_in_TIFF()
3584 sn = exif_file_sections_add(ImageInfo, M_PSEUDO, 2, NULL); in exif_process_IFD_in_TIFF()
3586 …f_error_docref(NULL EXIFERR_CC, ImageInfo, E_NOTICE, "Read from TIFF: filesize(x%04X), IFD dir(x%0… in exif_process_IFD_in_TIFF()
3588 …php_stream_seek(ImageInfo->infile, dir_offset, SEEK_SET); /* we do not know the order of sections … in exif_process_IFD_in_TIFF()
3589 php_stream_read(ImageInfo->infile, (char*)ImageInfo->file.list[sn].data, 2); in exif_process_IFD_in_TIFF()
3590 num_entries = php_ifd_get16u(ImageInfo->file.list[sn].data, ImageInfo->motorola_intel); in exif_process_IFD_in_TIFF()
3592 if (ImageInfo->FileSize >= dir_offset+dir_size) { in exif_process_IFD_in_TIFF()
3594 …ocref(NULL EXIFERR_CC, ImageInfo, E_NOTICE, "Read from TIFF: filesize(x%04X), IFD dir(x%04X + x%04… in exif_process_IFD_in_TIFF()
3596 if (exif_file_sections_realloc(ImageInfo, sn, dir_size TSRMLS_CC)) { in exif_process_IFD_in_TIFF()
3599 php_stream_read(ImageInfo->infile, (char*)(ImageInfo->file.list[sn].data+2), dir_size-2); in exif_process_IFD_in_TIFF()
3601 …next_offset = php_ifd_get32u(ImageInfo->file.list[sn].data + dir_size - 4, ImageInfo->motorola_int… in exif_process_IFD_in_TIFF()
3603 …exif_error_docref(NULL EXIFERR_CC, ImageInfo, E_NOTICE, "Read from TIFF done, next offset x%04X", … in exif_process_IFD_in_TIFF()
3608 dir_entry = ImageInfo->file.list[sn].data+2+i*12; in exif_process_IFD_in_TIFF()
3609 entry_tag = php_ifd_get16u(dir_entry+0, ImageInfo->motorola_intel); in exif_process_IFD_in_TIFF()
3610 entry_type = php_ifd_get16u(dir_entry+2, ImageInfo->motorola_intel); in exif_process_IFD_in_TIFF()
3612 …exif_error_docref(NULL EXIFERR_CC, ImageInfo, E_NOTICE, "Read from TIFF: tag(0x%04X,%12s): Illegal… in exif_process_IFD_in_TIFF()
3620 …entry_length = php_ifd_get32u(dir_entry+4, ImageInfo->motorola_intel) * php_tiff_bytes_per_format[… in exif_process_IFD_in_TIFF()
3624 entry_value = php_ifd_get16u(dir_entry+8, ImageInfo->motorola_intel); in exif_process_IFD_in_TIFF()
3627 entry_value = php_ifd_get16s(dir_entry+8, ImageInfo->motorola_intel); in exif_process_IFD_in_TIFF()
3630 entry_value = php_ifd_get32u(dir_entry+8, ImageInfo->motorola_intel); in exif_process_IFD_in_TIFF()
3633 entry_value = php_ifd_get32s(dir_entry+8, ImageInfo->motorola_intel); in exif_process_IFD_in_TIFF()
3639 ImageInfo->Width = entry_value; in exif_process_IFD_in_TIFF()
3643 ImageInfo->Height = entry_value; in exif_process_IFD_in_TIFF()
3650 ImageInfo->IsColor = 0; in exif_process_IFD_in_TIFF()
3657 ImageInfo->IsColor = 1; in exif_process_IFD_in_TIFF()
3663 entry_offset = php_ifd_get32u(dir_entry+8, ImageInfo->motorola_intel); in exif_process_IFD_in_TIFF()
3670 …exif_error_docref(NULL EXIFERR_CC, ImageInfo, E_NOTICE, "Resize struct: x%04X + x%04X - x%04X = x%… in exif_process_IFD_in_TIFF()
3675 if (ImageInfo->FileSize >= dir_offset + ImageInfo->file.list[sn].size) { in exif_process_IFD_in_TIFF()
3677 if (dir_offset + ifd_size > ImageInfo->FileSize) { in exif_process_IFD_in_TIFF()
3678 …_docref(NULL EXIFERR_CC, ImageInfo, E_WARNING, "Error in TIFF: filesize(x%04X) less than size of I… in exif_process_IFD_in_TIFF()
3681 if (exif_file_sections_realloc(ImageInfo, sn, ifd_size TSRMLS_CC)) { in exif_process_IFD_in_TIFF()
3686 …xif_error_docref(NULL EXIFERR_CC, ImageInfo, E_NOTICE, "Read from TIFF: filesize(x%04X), IFD(x%04X… in exif_process_IFD_in_TIFF()
3688 …php_stream_read(ImageInfo->infile, (char*)(ImageInfo->file.list[sn].data+dir_size), ifd_size-dir_s… in exif_process_IFD_in_TIFF()
3690 exif_error_docref(NULL EXIFERR_CC, ImageInfo, E_NOTICE, "Read from TIFF, done"); in exif_process_IFD_in_TIFF()
3695 dir_entry = ImageInfo->file.list[sn].data+2+i*12; in exif_process_IFD_in_TIFF()
3696 entry_tag = php_ifd_get16u(dir_entry+0, ImageInfo->motorola_intel); in exif_process_IFD_in_TIFF()
3697 entry_type = php_ifd_get16u(dir_entry+2, ImageInfo->motorola_intel); in exif_process_IFD_in_TIFF()
3706 ImageInfo->sections_found |= FOUND_EXIF; in exif_process_IFD_in_TIFF()
3710 ImageInfo->sections_found |= FOUND_GPS; in exif_process_IFD_in_TIFF()
3714 ImageInfo->sections_found |= FOUND_INTEROP; in exif_process_IFD_in_TIFF()
3718 ImageInfo->sections_found |= FOUND_THUMBNAIL; in exif_process_IFD_in_TIFF()
3722 entry_offset = php_ifd_get32u(dir_entry+8, ImageInfo->motorola_intel); in exif_process_IFD_in_TIFF()
3724 …exif_error_docref(NULL EXIFERR_CC, ImageInfo, E_NOTICE, "Next IFD: %s @x%04X", exif_get_sectionnam… in exif_process_IFD_in_TIFF()
3726 ImageInfo->ifd_nesting_level++; in exif_process_IFD_in_TIFF()
3727 exif_process_IFD_in_TIFF(ImageInfo, entry_offset, sub_section_index TSRMLS_CC); in exif_process_IFD_in_TIFF()
3729 if (ImageInfo->Thumbnail.filetype != IMAGE_FILETYPE_UNKNOWN in exif_process_IFD_in_TIFF()
3730 && ImageInfo->Thumbnail.size in exif_process_IFD_in_TIFF()
3731 && ImageInfo->Thumbnail.offset in exif_process_IFD_in_TIFF()
3732 && ImageInfo->read_thumbnail in exif_process_IFD_in_TIFF()
3735 …RR_CC, ImageInfo, E_NOTICE, "%s THUMBNAIL @0x%04X + 0x%04X", ImageInfo->Thumbnail.data ? "Ignore" … in exif_process_IFD_in_TIFF()
3737 if (!ImageInfo->Thumbnail.data) { in exif_process_IFD_in_TIFF()
3738 ImageInfo->Thumbnail.data = safe_emalloc(ImageInfo->Thumbnail.size, 1, 0); in exif_process_IFD_in_TIFF()
3739 php_stream_seek(ImageInfo->infile, ImageInfo->Thumbnail.offset, SEEK_SET); in exif_process_IFD_in_TIFF()
3740 … fgot = php_stream_read(ImageInfo->infile, ImageInfo->Thumbnail.data, ImageInfo->Thumbnail.size); in exif_process_IFD_in_TIFF()
3741 if (fgot < ImageInfo->Thumbnail.size) { in exif_process_IFD_in_TIFF()
3742 EXIF_ERRLOG_THUMBEOF(ImageInfo) in exif_process_IFD_in_TIFF()
3743 efree(ImageInfo->Thumbnail.data); in exif_process_IFD_in_TIFF()
3744 ImageInfo->Thumbnail.data = NULL; in exif_process_IFD_in_TIFF()
3746 exif_thumbnail_build(ImageInfo TSRMLS_CC); in exif_process_IFD_in_TIFF()
3752 …exif_error_docref(NULL EXIFERR_CC, ImageInfo, E_NOTICE, "Next IFD: %s done", exif_get_sectionname(… in exif_process_IFD_in_TIFF()
3755 if (!exif_process_IFD_TAG(ImageInfo, (char*)dir_entry, in exif_process_IFD_in_TIFF()
3756 (char*)(ImageInfo->file.list[sn].data-dir_offset), in exif_process_IFD_in_TIFF()
3767 …exif_error_docref(NULL EXIFERR_CC, ImageInfo, E_NOTICE, "Read next IFD (THUMBNAIL) at x%04X", next… in exif_process_IFD_in_TIFF()
3769 ImageInfo->ifd_nesting_level++; in exif_process_IFD_in_TIFF()
3770 exif_process_IFD_in_TIFF(ImageInfo, next_offset, SECTION_THUMBNAIL TSRMLS_CC); in exif_process_IFD_in_TIFF()
3772 …RR_CC, ImageInfo, E_NOTICE, "%s THUMBNAIL @0x%04X + 0x%04X", ImageInfo->Thumbnail.data ? "Ignore" … in exif_process_IFD_in_TIFF()
3774 …if (!ImageInfo->Thumbnail.data && ImageInfo->Thumbnail.offset && ImageInfo->Thumbnail.size && Imag… in exif_process_IFD_in_TIFF()
3775 ImageInfo->Thumbnail.data = safe_emalloc(ImageInfo->Thumbnail.size, 1, 0); in exif_process_IFD_in_TIFF()
3776 php_stream_seek(ImageInfo->infile, ImageInfo->Thumbnail.offset, SEEK_SET); in exif_process_IFD_in_TIFF()
3777 … fgot = php_stream_read(ImageInfo->infile, ImageInfo->Thumbnail.data, ImageInfo->Thumbnail.size); in exif_process_IFD_in_TIFF()
3778 if (fgot < ImageInfo->Thumbnail.size) { in exif_process_IFD_in_TIFF()
3779 EXIF_ERRLOG_THUMBEOF(ImageInfo) in exif_process_IFD_in_TIFF()
3780 efree(ImageInfo->Thumbnail.data); in exif_process_IFD_in_TIFF()
3781 ImageInfo->Thumbnail.data = NULL; in exif_process_IFD_in_TIFF()
3783 exif_thumbnail_build(ImageInfo TSRMLS_CC); in exif_process_IFD_in_TIFF()
3787 exif_error_docref(NULL EXIFERR_CC, ImageInfo, E_NOTICE, "Read next IFD (THUMBNAIL) done"); in exif_process_IFD_in_TIFF()
3792 … EXIFERR_CC, ImageInfo, E_WARNING, "Error in TIFF: filesize(x%04X) less than size of IFD(x%04X)", in exif_process_IFD_in_TIFF()
3796 …or_docref(NULL EXIFERR_CC, ImageInfo, E_WARNING, "Error in TIFF: filesize(x%04X) less than size of… in exif_process_IFD_in_TIFF()
3800 …or_docref(NULL EXIFERR_CC, ImageInfo, E_WARNING, "Error in TIFF: filesize(x%04X) less than start o… in exif_process_IFD_in_TIFF()
3808 static int exif_scan_FILE_header(image_info_type *ImageInfo TSRMLS_DC) in exif_scan_FILE_header()
3813 ImageInfo->FileType = IMAGE_FILETYPE_UNKNOWN; in exif_scan_FILE_header()
3815 if (ImageInfo->FileSize >= 2) { in exif_scan_FILE_header()
3816 php_stream_seek(ImageInfo->infile, 0, SEEK_SET); in exif_scan_FILE_header()
3817 if (php_stream_read(ImageInfo->infile, (char*)file_header, 2) != 2) { in exif_scan_FILE_header()
3821 ImageInfo->FileType = IMAGE_FILETYPE_JPEG; in exif_scan_FILE_header()
3822 if (exif_scan_JPEG_header(ImageInfo TSRMLS_CC)) { in exif_scan_FILE_header()
3825 exif_error_docref(NULL EXIFERR_CC, ImageInfo, E_WARNING, "Invalid JPEG file"); in exif_scan_FILE_header()
3827 } else if (ImageInfo->FileSize >= 8) { in exif_scan_FILE_header()
3828 if (php_stream_read(ImageInfo->infile, (char*)(file_header+2), 6) != 6) { in exif_scan_FILE_header()
3832 ImageInfo->FileType = IMAGE_FILETYPE_TIFF_II; in exif_scan_FILE_header()
3833 ImageInfo->motorola_intel = 0; in exif_scan_FILE_header()
3835 exif_error_docref(NULL EXIFERR_CC, ImageInfo, E_NOTICE, "File has TIFF/II format"); in exif_scan_FILE_header()
3837 ImageInfo->sections_found |= FOUND_IFD0; in exif_scan_FILE_header()
3838 if (exif_process_IFD_in_TIFF(ImageInfo, in exif_scan_FILE_header()
3839 php_ifd_get32u(file_header + 4, ImageInfo->motorola_intel), in exif_scan_FILE_header()
3843 exif_error_docref(NULL EXIFERR_CC, ImageInfo, E_WARNING, "Invalid TIFF file"); in exif_scan_FILE_header()
3846 ImageInfo->FileType = IMAGE_FILETYPE_TIFF_MM; in exif_scan_FILE_header()
3847 ImageInfo->motorola_intel = 1; in exif_scan_FILE_header()
3849 exif_error_docref(NULL EXIFERR_CC, ImageInfo, E_NOTICE, "File has TIFF/MM format"); in exif_scan_FILE_header()
3851 ImageInfo->sections_found |= FOUND_IFD0; in exif_scan_FILE_header()
3852 if (exif_process_IFD_in_TIFF(ImageInfo, in exif_scan_FILE_header()
3853 php_ifd_get32u(file_header + 4, ImageInfo->motorola_intel), in exif_scan_FILE_header()
3857 exif_error_docref(NULL EXIFERR_CC, ImageInfo, E_WARNING, "Invalid TIFF file"); in exif_scan_FILE_header()
3860 exif_error_docref(NULL EXIFERR_CC, ImageInfo, E_WARNING, "File not supported"); in exif_scan_FILE_header()
3865 …exif_error_docref(NULL EXIFERR_CC, ImageInfo, E_WARNING, "File too small (%d)", ImageInfo->FileSiz… in exif_scan_FILE_header()
3874 static int exif_discard_imageinfo(image_info_type *ImageInfo) in exif_discard_imageinfo() argument
3878 EFREE_IF(ImageInfo->FileName); in exif_discard_imageinfo()
3879 EFREE_IF(ImageInfo->UserComment); in exif_discard_imageinfo()
3880 EFREE_IF(ImageInfo->UserCommentEncoding); in exif_discard_imageinfo()
3881 EFREE_IF(ImageInfo->Copyright); in exif_discard_imageinfo()
3882 EFREE_IF(ImageInfo->CopyrightPhotographer); in exif_discard_imageinfo()
3883 EFREE_IF(ImageInfo->CopyrightEditor); in exif_discard_imageinfo()
3884 EFREE_IF(ImageInfo->Thumbnail.data); in exif_discard_imageinfo()
3885 EFREE_IF(ImageInfo->encode_unicode); in exif_discard_imageinfo()
3886 EFREE_IF(ImageInfo->decode_unicode_be); in exif_discard_imageinfo()
3887 EFREE_IF(ImageInfo->decode_unicode_le); in exif_discard_imageinfo()
3888 EFREE_IF(ImageInfo->encode_jis); in exif_discard_imageinfo()
3889 EFREE_IF(ImageInfo->decode_jis_be); in exif_discard_imageinfo()
3890 EFREE_IF(ImageInfo->decode_jis_le); in exif_discard_imageinfo()
3891 EFREE_IF(ImageInfo->make); in exif_discard_imageinfo()
3892 EFREE_IF(ImageInfo->model); in exif_discard_imageinfo()
3893 for (i=0; i<ImageInfo->xp_fields.count; i++) { in exif_discard_imageinfo()
3894 EFREE_IF(ImageInfo->xp_fields.list[i].value); in exif_discard_imageinfo()
3896 EFREE_IF(ImageInfo->xp_fields.list); in exif_discard_imageinfo()
3898 exif_iif_free(ImageInfo, i); in exif_discard_imageinfo()
3900 exif_file_sections_free(ImageInfo); in exif_discard_imageinfo()
3901 memset(ImageInfo, 0, sizeof(*ImageInfo)); in exif_discard_imageinfo()
3908 static int exif_read_file(image_info_type *ImageInfo, char *FileName, int read_thumbnail, int read_… in exif_read_file() argument
3914 memset(ImageInfo, 0, sizeof(*ImageInfo)); in exif_read_file()
3916 ImageInfo->motorola_intel = -1; /* flag as unknown */ in exif_read_file()
3918 ImageInfo->infile = php_stream_open_wrapper(FileName, "rb", STREAM_MUST_SEEK|IGNORE_PATH, NULL); in exif_read_file()
3919 if (!ImageInfo->infile) { in exif_read_file()
3920 exif_error_docref(NULL EXIFERR_CC, ImageInfo, E_WARNING, "Unable to open file"); in exif_read_file()
3924 if (php_stream_is(ImageInfo->infile, PHP_STREAM_IS_STDIO)) { in exif_read_file()
3927 exif_error_docref(NULL EXIFERR_CC, ImageInfo, E_WARNING, "Not a file"); in exif_read_file()
3928 php_stream_close(ImageInfo->infile); in exif_read_file()
3933 ImageInfo->FileDateTime = st.st_mtime; in exif_read_file()
3934 ImageInfo->FileSize = st.st_size; in exif_read_file()
3938 if (!ImageInfo->FileSize) { in exif_read_file()
3939 php_stream_seek(ImageInfo->infile, 0, SEEK_END); in exif_read_file()
3940 ImageInfo->FileSize = php_stream_tell(ImageInfo->infile); in exif_read_file()
3941 php_stream_seek(ImageInfo->infile, 0, SEEK_SET); in exif_read_file()
3945 php_basename(FileName, strlen(FileName), NULL, 0, &(ImageInfo->FileName), NULL TSRMLS_CC); in exif_read_file()
3946 ImageInfo->read_thumbnail = read_thumbnail; in exif_read_file()
3947 ImageInfo->read_all = read_all; in exif_read_file()
3948 ImageInfo->Thumbnail.filetype = IMAGE_FILETYPE_UNKNOWN; in exif_read_file()
3950 ImageInfo->encode_unicode = safe_estrdup(EXIF_G(encode_unicode)); in exif_read_file()
3951 ImageInfo->decode_unicode_be = safe_estrdup(EXIF_G(decode_unicode_be)); in exif_read_file()
3952 ImageInfo->decode_unicode_le = safe_estrdup(EXIF_G(decode_unicode_le)); in exif_read_file()
3953 ImageInfo->encode_jis = safe_estrdup(EXIF_G(encode_jis)); in exif_read_file()
3954 ImageInfo->decode_jis_be = safe_estrdup(EXIF_G(decode_jis_be)); in exif_read_file()
3955 ImageInfo->decode_jis_le = safe_estrdup(EXIF_G(decode_jis_le)); in exif_read_file()
3958 ImageInfo->ifd_nesting_level = 0; in exif_read_file()
3961 ret = exif_scan_FILE_header(ImageInfo TSRMLS_CC); in exif_read_file()
3963 php_stream_close(ImageInfo->infile); in exif_read_file()
3977 image_info_type ImageInfo; in PHP_FUNCTION() local
3984 memset(&ImageInfo, 0, sizeof(ImageInfo)); in PHP_FUNCTION()
4009 …exif_error_docref(NULL EXIFERR_CC, &ImageInfo, E_NOTICE, "Sections needed: %s", sections_str[0] ? … in PHP_FUNCTION()
4014 ret = exif_read_file(&ImageInfo, p_name, read_thumbnail, read_all TSRMLS_CC); in PHP_FUNCTION()
4015 sections_str = exif_get_sectionlist(ImageInfo.sections_found TSRMLS_CC); in PHP_FUNCTION()
4019 …exif_error_docref(NULL EXIFERR_CC, &ImageInfo, E_NOTICE, "Sections found: %s", sections_str[0] ? s… in PHP_FUNCTION()
4022 ImageInfo.sections_found |= FOUND_COMPUTED|FOUND_FILE;/* do not inform about in debug*/ in PHP_FUNCTION()
4024 if (ret == FALSE || (sections_needed && !(sections_needed&ImageInfo.sections_found))) { in PHP_FUNCTION()
4026 exif_discard_imageinfo(&ImageInfo); in PHP_FUNCTION()
4034 exif_error_docref(NULL EXIFERR_CC, &ImageInfo, E_NOTICE, "Generate section FILE"); in PHP_FUNCTION()
4038 exif_iif_add_str(&ImageInfo, SECTION_FILE, "FileName", ImageInfo.FileName TSRMLS_CC); in PHP_FUNCTION()
4039 exif_iif_add_int(&ImageInfo, SECTION_FILE, "FileDateTime", ImageInfo.FileDateTime TSRMLS_CC); in PHP_FUNCTION()
4040 exif_iif_add_int(&ImageInfo, SECTION_FILE, "FileSize", ImageInfo.FileSize TSRMLS_CC); in PHP_FUNCTION()
4041 exif_iif_add_int(&ImageInfo, SECTION_FILE, "FileType", ImageInfo.FileType TSRMLS_CC); in PHP_FUNCTION()
4042 …exif_iif_add_str(&ImageInfo, SECTION_FILE, "MimeType", (char*)php_image_type_to_mime_type(Ima… in PHP_FUNCTION()
4043 …exif_iif_add_str(&ImageInfo, SECTION_FILE, "SectionsFound", sections_str ? sections_str : "NONE" T… in PHP_FUNCTION()
4046 exif_error_docref(NULL EXIFERR_CC, &ImageInfo, E_NOTICE, "Generate section COMPUTED"); in PHP_FUNCTION()
4049 if (ImageInfo.Width>0 && ImageInfo.Height>0) { in PHP_FUNCTION()
4050 …exif_iif_add_fmt(&ImageInfo, SECTION_COMPUTED, "html" TSRMLS_CC, "width=\"%d\" height=\"%d\"", in PHP_FUNCTION()
4051 exif_iif_add_int(&ImageInfo, SECTION_COMPUTED, "Height", ImageInfo.Height TSRMLS_CC); in PHP_FUNCTION()
4052 exif_iif_add_int(&ImageInfo, SECTION_COMPUTED, "Width", ImageInfo.Width TSRMLS_CC); in PHP_FUNCTION()
4054 exif_iif_add_int(&ImageInfo, SECTION_COMPUTED, "IsColor", ImageInfo.IsColor TSRMLS_CC); in PHP_FUNCTION()
4055 if (ImageInfo.motorola_intel != -1) { in PHP_FUNCTION()
4056 …exif_iif_add_int(&ImageInfo, SECTION_COMPUTED, "ByteOrderMotorola", ImageInfo.motorola_intel TSRML… in PHP_FUNCTION()
4058 if (ImageInfo.FocalLength) { in PHP_FUNCTION()
4059 …exif_iif_add_fmt(&ImageInfo, SECTION_COMPUTED, "FocalLength" TSRMLS_CC, "%4.1Fmm", ImageInfo.Focal… in PHP_FUNCTION()
4060 if(ImageInfo.CCDWidth) { in PHP_FUNCTION()
4061 …exif_iif_add_fmt(&ImageInfo, SECTION_COMPUTED, "35mmFocalLength" TSRMLS_CC, "%dmm", (int)(ImageInf… in PHP_FUNCTION()
4064 if(ImageInfo.CCDWidth) { in PHP_FUNCTION()
4065 …exif_iif_add_fmt(&ImageInfo, SECTION_COMPUTED, "CCDWidth" TSRMLS_CC, "%dmm", (int)ImageInfo.CCDWid… in PHP_FUNCTION()
4067 if(ImageInfo.ExposureTime>0) { in PHP_FUNCTION()
4068 if(ImageInfo.ExposureTime <= 0.5) { in PHP_FUNCTION()
4069 …if_iif_add_fmt(&ImageInfo, SECTION_COMPUTED, "ExposureTime" TSRMLS_CC, "%0.3F s (1/%d)", ImageInfo in PHP_FUNCTION()
4071 …exif_iif_add_fmt(&ImageInfo, SECTION_COMPUTED, "ExposureTime" TSRMLS_CC, "%0.3F s", ImageInfo.Expo… in PHP_FUNCTION()
4074 if(ImageInfo.ApertureFNumber) { in PHP_FUNCTION()
4075 …exif_iif_add_fmt(&ImageInfo, SECTION_COMPUTED, "ApertureFNumber" TSRMLS_CC, "f/%.1F", ImageInfo.Ap… in PHP_FUNCTION()
4077 if(ImageInfo.Distance) { in PHP_FUNCTION()
4078 if(ImageInfo.Distance<0) { in PHP_FUNCTION()
4079 exif_iif_add_str(&ImageInfo, SECTION_COMPUTED, "FocusDistance", "Infinite" TSRMLS_CC); in PHP_FUNCTION()
4081 …exif_iif_add_fmt(&ImageInfo, SECTION_COMPUTED, "FocusDistance" TSRMLS_CC, "%0.2Fm", ImageInfo.Dist… in PHP_FUNCTION()
4084 if (ImageInfo.UserComment) { in PHP_FUNCTION()
4085 …exif_iif_add_buffer(&ImageInfo, SECTION_COMPUTED, "UserComment", ImageInfo.UserCommentLength, Imag… in PHP_FUNCTION()
4086 if (ImageInfo.UserCommentEncoding && strlen(ImageInfo.UserCommentEncoding)) { in PHP_FUNCTION()
4087 …exif_iif_add_str(&ImageInfo, SECTION_COMPUTED, "UserCommentEncoding", ImageInfo.UserCommentEncodin… in PHP_FUNCTION()
4091 …exif_iif_add_str(&ImageInfo, SECTION_COMPUTED, "Copyright", ImageInfo.Copyright TSRML… in PHP_FUNCTION()
4092 …exif_iif_add_str(&ImageInfo, SECTION_COMPUTED, "Copyright.Photographer", ImageInfo.CopyrightPhotog… in PHP_FUNCTION()
4093 …exif_iif_add_str(&ImageInfo, SECTION_COMPUTED, "Copyright.Editor", ImageInfo.CopyrightEditor… in PHP_FUNCTION()
4095 for (i=0; i<ImageInfo.xp_fields.count; i++) { in PHP_FUNCTION()
4096 …_str(&ImageInfo, SECTION_WINXP, exif_get_tagname(ImageInfo.xp_fields.list[i].tag, NULL, 0, exif_ge… in PHP_FUNCTION()
4098 if (ImageInfo.Thumbnail.size) { in PHP_FUNCTION()
4101 …exif_iif_add_tag(&ImageInfo, SECTION_THUMBNAIL, "THUMBNAIL", TAG_NONE, TAG_FMT_UNDEFINED, ImageInf… in PHP_FUNCTION()
4103 if (!ImageInfo.Thumbnail.width || !ImageInfo.Thumbnail.height) { in PHP_FUNCTION()
4105 exif_scan_thumbnail(&ImageInfo TSRMLS_CC); in PHP_FUNCTION()
4107 …exif_iif_add_int(&ImageInfo, SECTION_COMPUTED, "Thumbnail.FileType", ImageInfo.Thumbnail.filetype … in PHP_FUNCTION()
4108 …exif_iif_add_str(&ImageInfo, SECTION_COMPUTED, "Thumbnail.MimeType", (char*)php_image_type_to_mime… in PHP_FUNCTION()
4110 if (ImageInfo.Thumbnail.width && ImageInfo.Thumbnail.height) { in PHP_FUNCTION()
4111 …exif_iif_add_int(&ImageInfo, SECTION_COMPUTED, "Thumbnail.Height", ImageInfo.Thumbnail.height TSRM… in PHP_FUNCTION()
4112 …exif_iif_add_int(&ImageInfo, SECTION_COMPUTED, "Thumbnail.Width", ImageInfo.Thumbnail.width TSRML… in PHP_FUNCTION()
4117 exif_error_docref(NULL EXIFERR_CC, &ImageInfo, E_NOTICE, "Adding image infos"); in PHP_FUNCTION()
4120 add_assoc_image_info(return_value, sub_arrays, &ImageInfo, SECTION_FILE TSRMLS_CC); in PHP_FUNCTION()
4121 add_assoc_image_info(return_value, 1, &ImageInfo, SECTION_COMPUTED TSRMLS_CC); in PHP_FUNCTION()
4122 add_assoc_image_info(return_value, sub_arrays, &ImageInfo, SECTION_ANY_TAG TSRMLS_CC); in PHP_FUNCTION()
4123 add_assoc_image_info(return_value, sub_arrays, &ImageInfo, SECTION_IFD0 TSRMLS_CC); in PHP_FUNCTION()
4124 add_assoc_image_info(return_value, 1, &ImageInfo, SECTION_THUMBNAIL TSRMLS_CC); in PHP_FUNCTION()
4125 add_assoc_image_info(return_value, 1, &ImageInfo, SECTION_COMMENT TSRMLS_CC); in PHP_FUNCTION()
4126 add_assoc_image_info(return_value, sub_arrays, &ImageInfo, SECTION_EXIF TSRMLS_CC); in PHP_FUNCTION()
4127 add_assoc_image_info(return_value, sub_arrays, &ImageInfo, SECTION_GPS TSRMLS_CC); in PHP_FUNCTION()
4128 add_assoc_image_info(return_value, sub_arrays, &ImageInfo, SECTION_INTEROP TSRMLS_CC); in PHP_FUNCTION()
4129 add_assoc_image_info(return_value, sub_arrays, &ImageInfo, SECTION_FPIX TSRMLS_CC); in PHP_FUNCTION()
4130 add_assoc_image_info(return_value, sub_arrays, &ImageInfo, SECTION_APP12 TSRMLS_CC); in PHP_FUNCTION()
4131 add_assoc_image_info(return_value, sub_arrays, &ImageInfo, SECTION_WINXP TSRMLS_CC); in PHP_FUNCTION()
4132 add_assoc_image_info(return_value, sub_arrays, &ImageInfo, SECTION_MAKERNOTE TSRMLS_CC); in PHP_FUNCTION()
4135 exif_error_docref(NULL EXIFERR_CC, &ImageInfo, E_NOTICE, "Discarding info"); in PHP_FUNCTION()
4138 exif_discard_imageinfo(&ImageInfo); in PHP_FUNCTION()
4153 image_info_type ImageInfo; in PHP_FUNCTION() local
4155 memset(&ImageInfo, 0, sizeof(ImageInfo)); in PHP_FUNCTION()
4165 ret = exif_read_file(&ImageInfo, p_name, 1, 0 TSRMLS_CC); in PHP_FUNCTION()
4167 exif_discard_imageinfo(&ImageInfo); in PHP_FUNCTION()
4172ImageInfo, E_NOTICE, "Thumbnail data %d %d %d, %d x %d", ImageInfo.Thumbnail.data, ImageInfo.Thumb… in PHP_FUNCTION()
4174 if (!ImageInfo.Thumbnail.data || !ImageInfo.Thumbnail.size) { in PHP_FUNCTION()
4175 exif_discard_imageinfo(&ImageInfo); in PHP_FUNCTION()
4180 …exif_error_docref(NULL EXIFERR_CC, &ImageInfo, E_NOTICE, "Returning thumbnail(%d)", ImageInfo.Thum… in PHP_FUNCTION()
4183 ZVAL_STRINGL(return_value, ImageInfo.Thumbnail.data, ImageInfo.Thumbnail.size, 1); in PHP_FUNCTION()
4185 if (!ImageInfo.Thumbnail.width || !ImageInfo.Thumbnail.height) { in PHP_FUNCTION()
4186 exif_scan_thumbnail(&ImageInfo TSRMLS_CC); in PHP_FUNCTION()
4190 ZVAL_LONG(p_width, ImageInfo.Thumbnail.width); in PHP_FUNCTION()
4191 ZVAL_LONG(p_height, ImageInfo.Thumbnail.height); in PHP_FUNCTION()
4195 ZVAL_LONG(p_imagetype, ImageInfo.Thumbnail.filetype); in PHP_FUNCTION()
4199 exif_error_docref(NULL EXIFERR_CC, &ImageInfo, E_NOTICE, "Discarding info"); in PHP_FUNCTION()
4202 exif_discard_imageinfo(&ImageInfo); in PHP_FUNCTION()