aboutsummaryrefslogtreecommitdiffstats
path: root/include/functions_metadata.inc.php
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--include/functions_metadata.inc.php42
1 files changed, 42 insertions, 0 deletions
diff --git a/include/functions_metadata.inc.php b/include/functions_metadata.inc.php
index 2708810f1..d03327f60 100644
--- a/include/functions_metadata.inc.php
+++ b/include/functions_metadata.inc.php
@@ -91,4 +91,46 @@ function clean_iptc_value($value)
return $value;
}
+
+/**
+ * returns informations from EXIF metadata, mapping is done at the beginning
+ * of the function
+ *
+ * @param string $filename
+ * @return array
+ */
+function get_exif_data($filename, $map)
+{
+ $result = array();
+
+ if (!function_exists('read_exif_data'))
+ {
+ die('Exif extension not available, admin should disable exif use');
+ }
+
+ // Read EXIF data
+ if ($exif = @read_exif_data($filename))
+ {
+ foreach ($map as $key => $field)
+ {
+ if (strpos($field, ';') === false)
+ {
+ if (isset($exif[$field]))
+ {
+ $result[$key] = $exif[$field];
+ }
+ }
+ else
+ {
+ $tokens = explode(';', $field);
+ if (isset($exif[$tokens[0]][$tokens[1]]))
+ {
+ $result[$key] = $exif[$tokens[0]][$tokens[1]];
+ }
+ }
+ }
+ }
+
+ return $result;
+}
?> \ No newline at end of file