<?php for ($i = 0; $i < 100000; $i++) { $str = exif_tagname($i); if ($str) { echo "{$i}: {$str}\n"; } }
function wppa_exif_tag($tagname) { global $wppa_inv_exiftags; // Setup inverted matrix if (!is_array($wppa_inv_exiftags)) { $key = 0; while ($key < 65536) { $tag = exif_tagname($key); if ($tag != '') { $wppa_inv_exiftags[$tag] = $key; } $key++; if (!$key) { break; } // 16 bit server wrap around ( do they still exist??? ) } } // Search if (isset($wppa_inv_exiftags[$tagname])) { return sprintf('E#%04X', $wppa_inv_exiftags[$tagname]); } elseif (strlen($tagname) == 19) { if (substr($tagname, 0, 12) == 'UndefinedTag') { return 'E#' . substr($tagname, -4); } } else { return ''; } }
"0x4f" : "On, Red-eye reduction, Return detected", "0x50" : "Off, Red-eye reduction", "0x58" : "Auto, Did not fire, Red-eye reduction", "0x59" : "Auto, Fired, Red-eye reduction", "0x5d" : "Auto, Fired, Red-eye reduction, Return not detected", "0x5f" : "Auto, Fired, Red-eye reduction, Return detected"}'; $flashDic = json_decode($flashJson); $flashHexKey = '0x' . dechex($iFlash); //echo $flashDic->{$flashHexKey}; if ($flashDic->{$flashHexKey}) { return $flashDic->{$flashHexKey}; } else { return ""; } } # The tagnames can vary in different cameras $imgdir = "./"; $img_file = "AAR_1799.jpg"; echo $img_file . " <sub>TEST</sub>\n<br />"; echo '<img src="' . $imgdir . $img_file . '" alt="' . $img_file . '" title="' . $img_file . '" width="400" /><br /><br />'; $xf_data = exif_read_data($imgdir . $img_file); $tagIds = [0x10f, 0x110, 0x132, 0xa002, 0xa003, 0x8827, 0x9000, 0x9004, 0x9209]; for ($i = 0; $i < count($tagIds); $i++) { $tagg = exif_tagname($tagIds[$i]); echo '<br>' . $tagg . ' >>> ' . $xf_data[$tagg]; } $tagg = exif_tagname(0x112); $taggValue = $xf_data[$tagg]; echo '<br>' . $tagg . ' >>> ' . Orientation2String((int) $taggValue); echo '<img src="b.php?file=' . $img_file . '" />'; echo '<br>Flash >>> ' . Flash2String(16);
<?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===
$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(0, 1, 12345, -2345, 10.5, -10.5, 101234567000.0, 1.07654321E-9, 0.5, array(), array(0), array(1), array(1, 2), array('color' => 'red', 'item' => 'pen'), true, false, TRUE, FALSE, "", '', $undefined_var, $unset_var, new sample(), $file_handle, NULL, null); // loop through each element of the array and check the working of exif_tagname() // when $index argument 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===
<?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===