aboutsummaryrefslogtreecommitdiff
path: root/exif.class.php
diff options
context:
space:
mode:
authorSilvio <s1lv10@uol.com.br>2010-08-17 18:18:54 -0300
committerSilvio <s1lv10@uol.com.br>2010-08-17 18:18:54 -0300
commitc1159f9872aca3275af2a79b86692dc902726fcc (patch)
treeebce822f155bcdbabe510093868e3a1d150b0939 /exif.class.php
parent4bbaad3b1b0bba584ea8b817e8b21801839256de (diff)
downloadexif-c1159f9872aca3275af2a79b86692dc902726fcc.tar.gz
exif-c1159f9872aca3275af2a79b86692dc902726fcc.tar.bz2
Syncing with CVS changes
Diffstat (limited to 'exif.class.php')
-rw-r--r--exif.class.php45
1 files changed, 35 insertions, 10 deletions
diff --git a/exif.class.php b/exif.class.php
index 045f28a..b5ad35b 100644
--- a/exif.class.php
+++ b/exif.class.php
@@ -67,14 +67,20 @@ Class Exif {
}
$exif = exif_read_data($file, 0);
$arSmallExif = array();
- foreach ((array)$exif as $key => $value) {
- $arSmallExif[strtolower($key)] = $value;
- }
+ $arSmallExif = array_change_key_case((array)$exif, CASE_LOWER);
+ $arSmallExif['computed'] = array_change_key_case((array)$arSmallExif['computed'], CASE_LOWER); //why this function isn't recursive is beyond me
+ $arSmallExif['thumbnail'] = array_change_key_case((array)$arSmallExif['thumbnail'], CASE_LOWER);
+ $arSmallExif['comment'] = array_change_key_case((array)$arSmallExif['comment'], CASE_LOWER);
$info = array();
foreach ($arTagNames as $tagName) {
- if ($tagName['section'] != 'iptc' && !empty($arSmallExif[$tagName['tag']])) {
- $info[$tagName['section'] .'_'. $tagName['tag']] = $arSmallExif[$tagName['tag']];
+ if ($tagName['section'] != 'iptc') {
+ if (!empty($arSmallExif[$tagName['tag']])) {
+ $info[$tagName['section'] .'_'. $tagName['tag']] = $arSmallExif[$tagName['tag']];
+ }
+ elseif (!empty($arSmallExif[$tagName['section']][$tagName['tag']])) {
+ $info[$tagName['section'] .'_'. $tagName['tag']] = $arSmallExif[$tagName['section']][$tagName['tag']];
+ }
}
}
return $info;
@@ -86,17 +92,31 @@ Class Exif {
return $ending;
}
- public function readIPTCTags($file, $arTagNames=array()) {
+ /**
+ * Read IPTC tags.
+ *
+ * @param String $file
+ * Path to image to read IPTC from
+ *
+ * @param array $arTagNames
+ * An array of Strings that contain the IPTC to read
+ * If you leave this empty nothing will be returned, unless you select a special
+ * return style in the $arOptions
+ *
+ * @param array $arOptions
+ * The following options are possible:
+ * style: fullSmall
+ *
+ */
+ public function readIPTCTags($file, $arTagNames=array(), $arOptions=array()) {
$humanReadableKey = $this->getHumanReadableIPTCkey();
$size = GetImageSize ($file, $infoImage);
$iptc = empty($infoImage["APP13"]) ? array() : iptcparse($infoImage["APP13"]);
$arSmallIPTC = array();
if (is_array($iptc)) {
- foreach($iptc as $key => $value)
- {
+ foreach ($iptc as $key => $value) {
$resultTag = "";
- foreach($value as $innerkey => $innervalue)
- {
+ foreach ($value as $innerkey => $innervalue) {
if( ($innerkey+1) != count($value) ) {
$resultTag .= $innervalue . ", ";
}
@@ -107,6 +127,11 @@ Class Exif {
$arSmallIPTC[$humanReadableKey[$key]] = $resultTag;
}
}
+
+ if ($arOptions['style'] == 'fullSmall') {
+ return $arSmallIPTC;
+ }
+
$info = array();
foreach ($arTagNames as $tagName) {
if ($tagName['section'] == "iptc") {