// add Image func (this *FileService) AddImage(image info.File, albumId, userId string, needCheckSize bool) (ok bool, msg string) { image.CreatedTime = time.Now() if albumId != "" { image.AlbumId = bson.ObjectIdHex(albumId) } else { image.AlbumId = bson.ObjectIdHex(DEFAULT_ALBUM_ID) image.IsDefaultAlbum = true } image.UserId = bson.ObjectIdHex(userId) ok = db.Insert(db.Files, image) return }