aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--actions/upload.php5
-rw-r--r--lib/exif.php35
-rw-r--r--lib/watermark.php1
-rw-r--r--views/default/object/image.php9
4 files changed, 47 insertions, 3 deletions
diff --git a/actions/upload.php b/actions/upload.php
index dd50d2381..6e21fd7b0 100644
--- a/actions/upload.php
+++ b/actions/upload.php
@@ -8,6 +8,7 @@
global $CONFIG;
include_once dirname(dirname(__FILE__)) . "/lib/resize.php";
include_once dirname(dirname(__FILE__)) . "/lib/watermark.php";
+ include_once dirname(dirname(__FILE__)) . "/lib/exif.php";
// Get common variables
$access_id = (int) get_input("access_id");
@@ -155,7 +156,9 @@
tp_watermark($thumbs);
} // end of image library selector
-
+
+ //get and store the exif data
+ td_get_exif($file);
array_push($uploaded_images, $file->guid);
unset($file); // may not be needed but there seems to be a memory leak
diff --git a/lib/exif.php b/lib/exif.php
new file mode 100644
index 000000000..1b6c2cbd2
--- /dev/null
+++ b/lib/exif.php
@@ -0,0 +1,35 @@
+<?php
+include_once dirname(__FILE__) . "/tidypics.php";
+
+function td_get_exif(Elggfile $file) {
+ $my_file = str_replace("image", "", tp_get_img_dir()) . $file->getFilename();
+ $exif = exif_read_data($my_file);
+ create_metadata($file->getGUID(), "tp_exif", serialize($exif), "string", $file->getObjectOwnerGUID(), 2);
+}
+
+function tp_exif_formatted($file_guid) {
+ $metadata_exif = get_metadata_byname($file_guid, "tp_exif");
+ if($metadata_exif) {
+ $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']);
+ $Fnumber = $Fnumber[0] / $Fnumber[1];
+ $Focal = explode("/", $exif['FocalLength']);
+ $Focal = $Focal[0] / $Focal[1];
+
+ //prepare the text for return
+ $exif_text = "Model: ".$exif['Model']."<br>";
+ $exif_text .= "Shutter: ".$exif['ExposureTime']."<br>";
+ $exif_text .= "Aperture: f/".$Fnumber."<br>";
+ $exif_text .= "ISO Speed: ".$exif['ISOSpeedRatings']."<br>";
+ $exif_text .= "Focal Length: ".round($Focal)."mm<br>";
+ $exif_text .= "Captured: ". $exif['DateTime'];
+
+ return "<tr><td>$exif_text</td></tr>";
+ } else {
+ return false;
+ }
+}
+?> \ No newline at end of file
diff --git a/lib/watermark.php b/lib/watermark.php
index 813e298a7..64385ae4a 100644
--- a/lib/watermark.php
+++ b/lib/watermark.php
@@ -2,7 +2,6 @@
function tp_watermark($thumbs) {
include_once dirname(__FILE__) . "/tidypics.php";
-
global $CONFIG;
$user = get_user_entity_as_row($album->owner_guid);
diff --git a/views/default/object/image.php b/views/default/object/image.php
index f64942b61..546cd711e 100644
--- a/views/default/object/image.php
+++ b/views/default/object/image.php
@@ -5,6 +5,8 @@
*/
global $CONFIG;
+ include_once dirname(dirname(dirname(dirname(__FILE__)))) . "/lib/exif.php";
+
$file = $vars['entity'];
$file_guid = $file->getGUID();
$tags = $file->tags;
@@ -180,7 +182,12 @@ if ($photo_tags) {
'file_guid' => $file_guid, ) );
?>
-
+ <div id="tidypics_breadcrumbs">
+ <?php
+ $exif = tp_exif_formatted($file_guid);
+ if($exif) echo $exif;
+ ?>
+ </div>
<div id="tidypics_info">
<?php if (!is_null($tags)) { ?>
<div class="object_tag_string"><?php echo elgg_view('output/tags',array('value' => $tags));?></div>