简体   繁体   English

ArrowDB仪表板将照片上传给用户

[英]ArrowDB dashboard upload photo to user

when I upload a photo using the arrowdb dashboard on https://platform.appcelerator.com 当我使用https://platform.appcelerator.com上的arrowdb仪表板上传照片时

Cloud.Users.query only shows the photo_id Cloud.Users.query仅显示photo_id

but whne I created a new user using the dashboard and attached a phot it is showing in the Cloud.Users.query 但是当我使用仪表板创建了一个新用户并附加了它在Cloud.Users.query中显示的照片时

eg . 例如。 photo uploaded after user created 用户创建后上传的照片

{
"id": "563019f18cb04aede69e2111",
"first_name": "store1",
"last_name": "123",
"created_at": "2015-10-28T00:42:25+0000",
"updated_at": "2016-01-22T08:59:44+0000",
"external_accounts": [],
"confirmed_at": "2015-10-28T00:42:25+0000",
"username": "user",
"admin": "false",
"stats": {
    "photos": {
        "total_count": 0
    },
    "storage": {
        "used": 0
    }
},
"photo_id": "56a1dc083a654d090d126792",
"friend_counts": {
    "requests": 0,
    "friends": 0
}

} }

eg. 例如。 photo uploaded while creating user 创建用户时上传的照片

  {
"id": "56a1f0333a65234234390d7",
"first_name": "qqqq",
"last_name": "wwwe",
"created_at": "2016-01-22T09:02:43+0000",
"updated_at": "2016-01-22T09:07:18+0000",
"external_accounts": [],
"confirmed_at": "2016-01-22T09:02:43+0000",
"username": "qwe",
"admin": "false",
"stats": {
    "photos": {
        "total_count": 0
    },
    "storage": {
        "used": 0
    }
},
"photo": {
    "id": "56a1f0333a654d090d0390d8",
    "filename": "userPhoto.jpg",
    "size": 25394,
    "md5": "e20f4fcadf6cde9fccfb458dd11951d4",
    "created_at": "2016-01-22T09:02:43+0000",
    "updated_at": "2016-01-22T09:02:43+0000",
    "processed": true,
    "urls": {
        "original": "https://s3-us-west-1.amazonaws.com/storage-platform.cloud.appcelerator.com/xmqh1djNEIChtQFP6d37HNH5DQNCXQoX/photos/51/d4/56a1f0333a654d090d0390d9/userPhoto_original.jpg"
    },
    "content_type": "image/jpeg",
    "user": {
        "id": "56a1f0333a65234234390d7",
        "first_name": "qqqq",
        "last_name": "wwwe",
        "created_at": "2016-01-22T09:02:43+0000",
        "updated_at": "2016-01-22T09:07:18+0000",
        "external_accounts": [],
        "confirmed_at": "2016-01-22T09:02:43+0000",
        "username": "qwe",
        "admin": "false",
        "stats": {
            "photos": {
                "total_count": 0
            },
            "storage": {
                "used": 0
            }
        },
        "photo_id": "56a1f0333a654d090d0390d8",
        "friend_counts": {
            "requests": 0,
            "friends": 0
        }
    }
},
"friend_counts": {
    "requests": 0,
    "friends": 0
}
}

basically the user which had photo uploaded during creation shows this extra info 基本上,在创建过程中上传过照片的用户会显示此额外信息

"photo": {
    "id": "56a1f0333a654d090d0390d8",
    "filename": "userPhoto.jpg",
    "size": 25394,
    "md5": "e20f4fcadf6cde9fccfb458dd11951d4",
    "created_at": "2016-01-22T09:02:43+0000",
    "updated_at": "2016-01-22T09:02:43+0000",
    "processed": true,
    "urls": {
        "original": "https://s3-us-west-1.amazonaws.com/storage-platform.cloud.appcelerator.com/xmqh1djNEIChtQFP6d37HNH5DQNCXQoX/photos/51/d4/56a1f0333a654d090d0390d9/userPhoto_original.jpg"
    },
    "content_type": "image/jpeg",
    "user": {
        "id": "56a1f0333a65234234390d7",
        "first_name": "qqqq",
        "last_name": "wwwe",
        "created_at": "2016-01-22T09:02:43+0000",
        "updated_at": "2016-01-22T09:07:18+0000",
        "external_accounts": [],
        "confirmed_at": "2016-01-22T09:02:43+0000",
        "username": "qwe",
        "admin": "false",
        "stats": {
            "photos": {
                "total_count": 0
            },
            "storage": {
                "used": 0
            }
        },

I've been experiencing also that kind of problem, plus I've noticed that the images won't show up from the ArrowDB user interface (not sure if related). 我也遇到过此类问题,另外我还注意到,图像不会从ArrowDB用户界面中显示(不确定是否相关)。 The API returns only an empty object when you query the model: photo: {} 查询模型时,API仅返回一个空对象: photo: {}

I've been creating a ticket for the ArrowDB user interface https://jira.appcelerator.org/browse/API-1277 . 我一直在为ArrowDB用户界面https://jira.appcelerator.org/browse/API-1277创建票证。

sachinmw did you create a ticket for the initial problem yet? sachinmw您是否已为最初的问题创建了票证?

A workaround could be to use the photo_id and run another separate query to retrieve the photo model but this is not good for network optimisation purposes. 一种解决方法是使用photo_id并运行另一个单独的查询来检索照片模型,但这对于网络优化目的不是很好。


EDIT 编辑

Ok after dealing with Appcelerator directly about having an empty photo: {} Object return the answer is pretty simple: 直接与Appcelerator处理空photo: {}对象返回,答案很简单:

Whenever you use the query() function like Cloud.Objects.query() from ti.cloud on any ArrowDB object, there is a parameter called response_json_depth which is set to 1 by default and will only return one level of the JSON Object returned by the API. 每当你使用query()之类的函数Cloud.Objects.query()ti.cloud任何ArrowDB对象上,有一个参数调用response_json_depth被设置为1在默认情况下,将只返回被返回的JSON对象的一个水平API。

Without touching that parameter I was seeing: 在不触摸该参数的情况下,我看到了:

{
    "Vehicle": [
        {
            "name": "foo",
            "photo: {}
        }
    ]
}

By setting response_json_depth to 3 I managed to have: 通过将response_json_depth设置为3我设法做到了:

{
    "Vehicle": [
        {
            "name": "foo",
            "photo: {
                "urls": {
                    "original": "http://bar.com"
                }
            }
        }
    ]
}

Hope that will help someone. 希望能对某人有所帮助。 The also applies for the Cloud.Objects.show() method for any ArrowDB object. 它还适用于任何ArrowDB对象的Cloud.Objects.show()方法。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM