sort images by time like f-spot does
[phpfspot.git] / phpfspot.class.php
index 27a0079e30936f194877c3cd582530dedf4e3a8c..5b18be5c90f870b86e297ba83f6c0d61767b4fea 100644 (file)
@@ -176,14 +176,20 @@ class PHPFSPOT {
          $selected = substr($selected, 0, strlen($selected)-1);
          $result = $this->db->db_query("
             SELECT DISTINCT photo_id
-            FROM photo_tags
-            WHERE tag_id IN (". $selected .")
+               FROM photo_tags pt
+            INNER JOIN photos p
+               ON p.id=pt.photo_id
+            WHERE pt.tag_id IN (". $selected .")
+            ORDER BY p.time ASC
          ");
       }
       else {
          $result = $this->db->db_query("
             SELECT DISTINCT photo_id
-            FROM photo_tags
+               FROM photo_tags pt
+            INNER JOIN photos p
+               ON p.id=pt.photo_id
+            ORDER BY p.time ASC
          ");
       }