forked from GNUsocial/gnu-social
Users now post photos to separate albums in the DB (still need to display them separately.)
This commit is contained in:
parent
cc18dcb82d
commit
fc131c2fb6
@ -113,7 +113,6 @@ class PhotouploadAction extends Action
|
|||||||
|
|
||||||
function uploadPhoto()
|
function uploadPhoto()
|
||||||
{
|
{
|
||||||
common_log(LOG_INFO, 'Is this function even getting called?');
|
|
||||||
$cur = common_current_user();
|
$cur = common_current_user();
|
||||||
if(empty($cur)) {
|
if(empty($cur)) {
|
||||||
return;
|
return;
|
||||||
@ -137,8 +136,15 @@ class PhotouploadAction extends Action
|
|||||||
$uri = 'http://' . common_config('site', 'server') . '/file/' . $filename;
|
$uri = 'http://' . common_config('site', 'server') . '/file/' . $filename;
|
||||||
$thumb_uri = 'http://' . common_config('site', 'server') . '/file/thumb.' . $filename;
|
$thumb_uri = 'http://' . common_config('site', 'server') . '/file/thumb.' . $filename;
|
||||||
$profile_id = $cur->id;
|
$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');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -69,8 +69,8 @@ class GNUsocialPhotoAlbum extends Memcached_DataObject
|
|||||||
|
|
||||||
function sequenceKey()
|
function sequenceKey()
|
||||||
{
|
{
|
||||||
return array(false, false, false);
|
return array('album_id', true, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
static function newAlbum($profile_id, $album_name)
|
static function newAlbum($profile_id, $album_name)
|
||||||
{
|
{
|
||||||
@ -81,14 +81,16 @@ class GNUsocialPhotoAlbum extends Memcached_DataObject
|
|||||||
}
|
}
|
||||||
|
|
||||||
$album = new GNUsocialPhotoAlbum();
|
$album = new GNUsocialPhotoAlbum();
|
||||||
//TODO: Should autoincrement..
|
|
||||||
$album->profile_id = $profile_id;
|
$album->profile_id = $profile_id;
|
||||||
$album->album_name = $album_name;
|
$album->album_name = $album_name;
|
||||||
|
|
||||||
if ($album->insert() == false){
|
$album->album_id = $album->insert();
|
||||||
|
if (!$album->album_id){
|
||||||
common_log_db_error($album, 'INSERT', __FILE__);
|
common_log_db_error($album, 'INSERT', __FILE__);
|
||||||
throw new ServerException(_m('Error creating new album.'));
|
throw new ServerException(_m('Error creating new album.'));
|
||||||
}
|
}
|
||||||
|
common_log(LOG_INFO, 'album_id : ' . $album->album_id);
|
||||||
|
return $album;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user