]> git.mxchange.org Git - quix0rs-gnu-social.git/blobdiff - plugins/GNUsocialPhotos/actions/photoupload.php
Users now post photos to separate albums in the DB (still need to display them separa...
[quix0rs-gnu-social.git] / plugins / GNUsocialPhotos / actions / photoupload.php
index 84caf474754aebf2bc4110f4d6e79dabe4f3f872..a0dfd56bb439ec3784055e845f8a3a8b58caeb63 100644 (file)
@@ -113,7 +113,6 @@ class PhotouploadAction extends Action
 
     function uploadPhoto()
     {
-        common_log(LOG_INFO, 'Is this function even getting called?');
         $cur = common_current_user();
         if(empty($cur)) {
             return;
@@ -137,8 +136,15 @@ class PhotouploadAction extends Action
         $uri = 'http://' . common_config('site', 'server') . '/file/' . $filename;
         $thumb_uri = 'http://' . common_config('site', 'server') . '/file/thumb.' . $filename;
         $profile_id = $cur->id;
-               //scorbett: the second arg below should be set to the album ID
-        GNUsocialPhoto::saveNew($profile_id, 0, $thumb_uri, $uri, 'web');
+       
+        // TODO: proper multiple album support 
+        $album = GNUsocialPhotoAlbum::staticGet('profile_id', $profile_id);
+        if(!$album) {
+            $album = GNUsocialPhotoAlbum::newAlbum($profile_id, 'Default');
+            GNUsocialPhoto::saveNew($profile_id, $album->album_id, $thumb_uri, $uri, 'web');
+        } else {
+            GNUsocialPhoto::saveNew($profile_id, $album->album_id, $thumb_uri, $uri, 'web');
+        }
     }
 
 }