Set Default Profile Picture For Parse Signup
I am trying to set default profile picture at signup time in parse.the picture is in my project folder. Is there any way to set it without photo upload. var user = new Parse.User()
Solution 1:
You can use Parse Config and Cloud Code for this purpose. Upload a default profile picture to a Config field called: defaultProfilePicture.
Then use this in Cloud Code:
Parse.Cloud.beforeSave(Parse.User, function (request, response) {
//check if user being saved has profile picture.
if (!request.object.has("profilePicture")) {
Parse.Config.get().then(function(config) {
request.object.set("profilePicture", config.get("defaultProfilePicture"));
response.success();
});
} else {
response.success();
}
});
Post a Comment for "Set Default Profile Picture For Parse Signup"