static function saveNew($profile_id, $album_id, $thumb_uri, $uri, $source, $insert_now, $title = null, $photo_description = null) { $photo = new GNUsocialPhoto(); $photo->thumb_uri = $thumb_uri; $photo->uri = $uri; $photo->album_id = $album_id; if (!empty($title)) { $photo->title = $title; } if (!empty($photo_description)) { $photo->photo_description = (string) $photo_description; } if ($insert_now) { $notice = Notice::saveNew($profile_id, $uri, $source); $photo->notice_id = $notice->id; $photo_id = $photo->insert(); if (!$photo_id) { common_log_db_error($photo, 'INSERT', __FILE__); throw new ServerException(_m('Problem Saving Photo.')); } } else { GNUsocialPhotoTemp::$tmp = $photo; Notice::saveNew($profile_id, $uri, $source); } }