aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/exif.php104
-rw-r--r--views/default/tidypics/css.php5
-rw-r--r--views/default/tidypics/exif.php6
3 files changed, 56 insertions, 59 deletions
diff --git a/lib/exif.php b/lib/exif.php
index 5382fbc9f..9d5ae6343 100644
--- a/lib/exif.php
+++ b/lib/exif.php
@@ -14,72 +14,62 @@ function td_get_exif($file) {
function tp_exif_formatted($file_guid) {
$metadata_exif = get_metadata_byname($file_guid, "tp_exif");
- if(!$metadata_exif) { //try to load it from the file if its not in the database
+ if (!$metadata_exif) { //try to load it from the file if its not in the database
$file = new ElggFile($file_guid);
td_get_exif($file);
unset($file);
$metadata_exif = get_metadata_byname($file_guid, "tp_exif");
}
- if($metadata_exif) {
+ if (!$metadata_exif) {
+ return false;
+ }
+
+ $exif = unserialize($metadata_exif["value"]);
+
+ $model = $exif['Model'];
+ if(!$model) $model = "N/A";
+ $exif_data['Model'] = $model;
- $exif = unserialize($metadata_exif["value"]);
-
- //got the code snippet below from http://www.zenphoto.org/support/topic.php?id=17
- //convert the raw values to understandible values
- $Fnumber = explode("/", $exif['FNumber']);
-
- if ($Fnumber[1] != 0)
- $Fnumber = $Fnumber[0] / $Fnumber[1];
- else
- $Fnumber = 0;
-
- if(!$Fnumber) {
- $Fnumber = "N/A";
- } else {
- $Fnumber = "f/$Fnumber";
- }
-
- $Focal = explode("/", $exif['FocalLength']);
- if ($Focal[1] != 0)
- $Focal = $Focal[0] / $Focal[1];
- else
- $Focal = 0;
- if(!$Focal || round($Focal) == "0") $Focal = 0;
- if(round($Focal) == 0) {
- $Focal = "N/A";
- } else {
- $Focal = round($Focal) . "mm";
- }
+ $exposure = $exif['ExposureTime'];
+ if (!$exposure) $exposure = "N/A";
+ $exif_data['Shutter'] = $exposure;
- $model = $exif['Model'];
- if(!$model) $model = "N/A";
-
- $exposure = $exif['ExposureTime'];
- if(!$exposure) $exposure = "N/A";
-
- $iso = $exif['ISOSpeedRatings'];
- if(!$iso) $iso = "N/A";
-
- $captured = $exif['DateTime'];
- if(!$captured) $captured = "N/A";
-
- //prepare the text for return
-
- $exif_text = "Model: ".$model."<br>";
- $exif_text .= "Shutter: ".$exposure."<br>";
- $exif_text .= "Aperture: ".$Fnumber."<br>";
- $exif_text .= "ISO Speed: ".$iso."<br>";
- if(round($Focal) == 0) {
- $exif_text .= "Focal Length: N/A<br>";
- } else {
- $exif_text .= "Focal Length: " . round($Focal) . "mm<br />";
- }
- $exif_text .= "Captured: ". $captured;
-
- return $exif_text;
+ //got the code snippet below from http://www.zenphoto.org/support/topic.php?id=17
+ //convert the raw values to understandible values
+ $Fnumber = explode("/", $exif['FNumber']);
+ if ($Fnumber[1] != 0)
+ $Fnumber = $Fnumber[0] / $Fnumber[1];
+ else
+ $Fnumber = 0;
+ if (!$Fnumber) {
+ $Fnumber = "N/A";
} else {
- return false;
+ $Fnumber = "f/$Fnumber";
}
+ $exif_data['Aperture'] = $Fnumber;
+
+ $iso = $exif['ISOSpeedRatings'];
+ if (!$iso) $iso = "N/A";
+ $exif_data['ISO Speed'] = $iso;
+
+ $Focal = explode("/", $exif['FocalLength']);
+ if ($Focal[1] != 0)
+ $Focal = $Focal[0] / $Focal[1];
+ else
+ $Focal = 0;
+ if (!$Focal || round($Focal) == "0") $Focal = 0;
+ if (round($Focal) == 0) {
+ $Focal = "N/A";
+ } else {
+ $Focal = round($Focal) . "mm";
+ }
+ $exif_data['Focal Length'] = $Focal;
+
+ $captured = $exif['DateTime'];
+ if (!$captured) $captured = "N/A";
+ $exif_data['Captured'] = $captured;
+
+ return $exif_data;
}
?> \ No newline at end of file
diff --git a/views/default/tidypics/css.php b/views/default/tidypics/css.php
index 198bf4643..3ade75ff4 100644
--- a/views/default/tidypics/css.php
+++ b/views/default/tidypics/css.php
@@ -63,6 +63,11 @@ display:inline;
padding:20px;
}
+#tidypics_exif {
+padding-left:20px;
+font-size:80%;
+}
+
.tidypics_album_images {
float:left;
width:153px;
diff --git a/views/default/tidypics/exif.php b/views/default/tidypics/exif.php
index d6b455309..525665754 100644
--- a/views/default/tidypics/exif.php
+++ b/views/default/tidypics/exif.php
@@ -4,8 +4,10 @@
$exif = tp_exif_formatted($guid);
if ($exif) {
- echo '<div id="tidypics_breadcrumbs">';
- echo $exif;
+ echo '<div id="tidypics_exif">';
+ foreach ($exif as $name => $value) {
+ echo $name . ': ' . $value . '<br />';
+ }
echo '</div>';
}