better display of description and time for a single photo
[photo-tags.git] / getjson.php
index 432b32468fdd6f0a6d3c03cae71f2a4bd4830f1a..ff41ac46ee498655186d30ecd6643786a5bd79c6 100644 (file)
@@ -1,5 +1,25 @@
 <?php
 
+  /**
+    copyright 2012,2013 Arun Persaud <arun@nubati.net>
+
+    This file is part of photo-tags.
+
+    Photo-tags is free software: you can redistribute it and/or modify
+    it under the terms of the GNU General Public License as published by
+    the Free Software Foundation, either version 3 of the License, or
+    (at your option) any later version.
+
+    Photo-tags is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+    GNU General Public License for more details.
+
+    You should have received a copy of the GNU General Public License
+    along with Photo-tags.  If not, see <http://www.gnu.org/licenses/>.
+
+  **/
+
 $N=30;
 
 /* parse ini -file */
@@ -67,9 +87,16 @@ if (isset($_REQUEST["S"]))
  else if (isset($_REQUEST["ID"]) && !isset($_REQUEST["C"]))
   {
     $id  = intval($_REQUEST["ID"]);
-    $result = $DB->query("SELECT base_uri, filename, id FROM photos".
+    $result = $DB->query("SELECT base_uri, filename, id, description, time FROM photos".
                         " WHERE id=$id");
   }
+ else if (isset($_REQUEST["IDT"]))
+   {  /* tags of a single image */
+    $id  = intval($_REQUEST["IDT"]);
+    $result = $DB->query("SELECT t.name as name FROM photo_tags pt ".
+                        " LEFT JOIN tags t on t.id=pt.tag_id".
+                        " WHERE pt.photo_id=$id");
+  }
  else if (isset($_REQUEST["CLOUD"]))
   {
     $result = $DB->query("SELECT t.name as name, count(*) as count FROM photo_tags pt ".