aboutsummaryrefslogtreecommitdiff
path: root/www/inc/exif.inc.php
diff options
context:
space:
mode:
authorjimmacfx <jimmacfx@4fa712ea-3c06-0410-9261-c11b4c06c003>2005-11-25 22:16:10 +0000
committerjimmacfx <jimmacfx@4fa712ea-3c06-0410-9261-c11b4c06c003>2005-11-25 22:16:10 +0000
commit4023001a68b3d85891ab744eb77e7b22a9dd8e3f (patch)
tree8ef9fadd91e07cae3bcc1284cc06a850f818168b /www/inc/exif.inc.php
parent796ade427c4b26271d879d2c1f58def958d51568 (diff)
downloadoriginal-4023001a68b3d85891ab744eb77e7b22a9dd8e3f.tar.gz
original-4023001a68b3d85891ab744eb77e7b22a9dd8e3f.tar.bz2
import original 0.11
git-svn-id: https://forgesvn1.novell.com/svn/original/trunk@2 4fa712ea-3c06-0410-9261-c11b4c06c003
Diffstat (limited to 'www/inc/exif.inc.php')
-rw-r--r--www/inc/exif.inc.php139
1 files changed, 139 insertions, 0 deletions
diff --git a/www/inc/exif.inc.php b/www/inc/exif.inc.php
new file mode 100644
index 0000000..be76168
--- /dev/null
+++ b/www/inc/exif.inc.php
@@ -0,0 +1,139 @@
+<?php
+if ($exif_prog=="php4") {
+ // php internal handling
+ // read_exif_data is supposed to read the whole jpeg into memory,
+ // so we'll use the thumbnails to save it
+ // THIS IS COMPLETELY UNTESTED!!!!
+ $exif_array = read_exif_data("$thumb");
+ if ($exif_style=="descriptive") {
+ // fancy table look
+ echo "<table border=\"0\" align=\"center\">\n";
+ //co ukazat (podle exif_show
+ if ($exif_show) {
+ while(list($k,$v)=each($exif_array)) {
+ while ($x = current($exif_show)) {
+ if ($x==$k) {
+ echo "<tr>";
+ echo "<td align=\"right\">$k :</td>";
+ echo "<td><b>$v</b></td>";
+ echo "</tr>\n";
+ }
+ next($exif_show);
+ }
+ }
+ } else {
+ //ukaze vsechno
+ while(list($k,$v)=each($exif_array)) {
+ echo "<tr>";
+ echo "<td align=\"right\">$k :</td>";
+ echo "<td><b>$v</b></td>";
+ echo "</tr>\n";
+ }
+ }
+ echo "<tr>\n";
+ echo "<td></td>";
+ # only show if EXIF header exists
+ if ($exif_array["Make"]) {
+ echo "<td><a href=\"$ThisScript?galerie=$galerie&snimek=$snimek";
+ echo "&exif_style=simple&show_thumbs=$show_thumbs\">";
+ echo "<b>display line</b></a></td>\n";
+ }
+ echo "</tr>\n";
+ echo "</table>\n";
+ echo "</table>";
+ } else {
+ // in one line
+ if ($exif_show) {
+ while(list($k,$v)=each($exif_array)) {
+ while ($x = current($exif_show)) {
+ if ($x==$k) {
+ echo "$v | ";
+ }
+ next($exif_show);
+ }
+ }
+ } else {
+ while(list($k,$v)=each($exif_array)) {
+ echo "$v | ";
+ }
+ }
+ # only show if EXIF header exists
+ if ($exif_array["Make"]) {
+ echo "<a href=\"$ThisScript?galerie=$galerie&snimek=$snimek";
+ echo "&exif_style=descriptive&show_thumbs=$show_thumbs\">";
+ echo "<b>display table</b></a>\n";
+ echo "</p>\n";
+ }
+ }
+
+} else {
+ // the old code, handles e.g. metacam and jhead as EXIF extractors
+ // loading lq means it won't work if the convertor doesn't copy EXIF data
+ // (newer ImageMagick can)
+ exec("$exif_prog \"$gallery_dir/$galerie/lq/img-$snimek.jpg\"", $exif_data, $exif_status);
+ if ($exif_status!="2") {
+ if ($exif_style=="descriptive") {
+ // fancy table look
+ echo "<table border=\"0\" align=\"center\">\n";
+ while ($x = current($exif_data)) {
+ eregi("^ *([^:]*): *(.*)", $x, $y);
+ //filter according to $exif_show array
+ if (!$exif_show) { //all fields shown
+ echo "<tr>";
+ echo "<td align=\"right\">$y[1] :</td>";
+ echo "<td><b>$y[2]</b></td>";
+ echo "</tr>\n";
+ } else {
+ reset($exif_show);
+ while ($z = current($exif_show)) {
+ //echo ".$z. ::: .$y[1].<br>";
+ if (trim($z) == trim($y[1])) {
+ echo "<tr>";
+ echo "<td align=\"right\">$y[1] :</td>";
+ echo "<td><b>$y[2]</b></td>";
+ echo "</tr>\n";
+ }
+ next($exif_show);
+ }
+ }
+ next($exif_data);
+ }
+ echo "<tr>\n";
+ echo "<td></td>";
+ # only show if EXIF header exists
+ if ($y[1]!="File") { // don't show when no EXIF
+ echo "<td><a href=\"$ThisScript?galerie=$galerie&snimek=$snimek";
+ echo "&exif_style=simple&show_thumbs=$show_thumbs\">";
+ echo "<b>display line</b></a></td>\n";
+ }
+ echo "</tr>\n";
+ echo "</table>\n";
+ } else {
+ //simple plaintext look
+ echo "<p class=\"exif\" align=\"center\">";
+ while ($x = current($exif_data)) {
+ eregi("^ *([^:]*): *(.*)", $x, $y);
+ if (!$exif_show) { //all fields shown
+ echo "$y[2] |";
+ } else {
+ reset($exif_show);
+ while ($z = current($exif_show)) {
+ if (trim($z) == trim($y[1])) {
+ echo "$y[2] | ";
+ }
+ next($exif_show);
+ }
+ }
+ next($exif_data);
+ }
+ # only show if EXIF header exists
+ if ($y[1]!="File") {
+ echo "<a href=\"$ThisScript?galerie=$galerie&snimek=$snimek";
+ echo "&exif_style=descriptive&show_thumbs=$show_thumbs\">";
+ echo "<b>display table</b></a>\n";
+ echo "</p>\n";
+ }
+ }
+ }
+}
+?>