Skip to content

Instantly share code, notes, and snippets.

@jnsdls
Created September 13, 2016 08:28
Show Gist options
  • Save jnsdls/1aea5efe12b623899bfe341d246e82a7 to your computer and use it in GitHub Desktop.
Save jnsdls/1aea5efe12b623899bfe341d246e82a7 to your computer and use it in GitHub Desktop.
handleTakePhoto() {
this.props.bebo.Camera.capturePhoto((image_uri) => {
// I'm doing a bunch of image manipulation here before sending the resulting base64 to savePhoto()
})
}
savePhoto(base64) {
const { actingUser, saving } = this.state;
if(!actingUser){ return console.error('need acting user to save image')}
if(!base64){ return console.error('need savable base64 to save image, but got', base64)}
// the bebo.uploadImage function takes base64 and returns an absolute URL
this.props.bebo.uploadImage(base64).then((upload_resp) => {
// building our photo object
const photo = {
user: actingUser,
image_url: upload_resp
};
this.Db.Photos.POST(photo).then((save_resp) => {
// we're handling the response of saving the image here
})
})
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment