0

I am attempting to add a functionality where users can select a profile pic from their mobile gallery and set it. For this, i am using react native and nodejs. I successfully upload a file to s3 using nodejs, get a URL and store that URL in the database as the users profile pic. I now need to do the front end, and i am really struggling with this. How would load the URL in react native so the profile pic is visible. Thank you.

2 Answers 2

1

Very easy:

import {Image} from 'react-native';
<Image
   style={{width: 300, height: 300}}
   source={{uri: _urlOfImage}} />
Sign up to request clarification or add additional context in comments.

2 Comments

Hey friend. Thank you so much but one thing. I have implemented upload in node(my backend) and get the url from there, so.how would i know what the upload url is. If a user selects an image how do i get the url from the backend?
How would i get the url of an image the user uploaded, when i have the url in the backend ?
0

data.location is the path of image stored in aws

s3.upload(params, function (err, data) {
if (err) {
console.log("Error", err);
}
if (data) {`enter code here`
res.json({ "imagAwsPath": data.Location })
}

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.