{"bucketName": "documents", "chunkSize": 261120, "contentType":"image/png", "encoding": "7bit", "fieldname": "Files", "filename":"profile5.png", "id": "62e8c15571dc52ad4c47de2c", "md5": null,"metadata": null, "mimetype": "image/png", "originalname": "profile5.png", "size": 10072, "uploadDate":"2022-08-02T06:16:54.079Z"}.
this data converted into base64 data {
eyJmaWVsZG5hbWUiOiJGaWxlcyIsIm9yaWdpbmFsbmFtZSI6InByb2ZpbGUucG5nIiwiZW5jb2RpbmciOiI3Yml0IiwibWltZXR5cGUiOiJpbWFnZS9wbmciLCJpZCI6IjYyZjc3NWIwNGVmNTkyYjAzYWIwYWU5ZCIsImZpbGVuYW1lIjoicHJvZmlsZS5wbmciLCJtZXRhZGF0YSI6bnVsbCwiYnVja2V0TmFtZSI6ImRvY3VtZW50cyIsImNodW5rU2l6ZSI6MjYxMTIwLCJzaXplIjozNjE0LCJtZDUiOm51bGwsInVwbG9hZERhdGUiOiIyMDIyLTA4LTEzVDA5OjU4OjA5LjIwNloiLCJjb250ZW50VHlwZSI6ImltYWdlL3BuZyJ9
}.
and then in react native my image as
{ <Image style={{width: 50, height: 50}} source={{uri:data:image/png;base64,${source}
}}/>}
source is the base64 data but image not shown plzz any one help me i am stuck in this almost 2 weeks :(.thanks in advance:)
Asked
Active
Viewed 394 times
1

Durgadevi
- 11
- 3
-
This isn't an image, it's metadata about an image. You would have to have a local or remote path to the image, or the base64 data, to display it. – Abe Aug 11 '22 at 19:05
-
Please provide enough code so others can better understand or reproduce the problem. – Community Aug 12 '22 at 08:54
-
Did u solve the issue ? – Anand Aug 12 '22 at 12:30
-
@Abe thanks for your response. But i am a begginer in react native so i don't know about metadata to base64. plz help me to sole this – Durgadevi Aug 13 '22 at 04:48
-
Metadata just means that it is not the data you need, it only describes the data. You need a path like `http://image-host.com/image.jpg`. If you can visit the link in a browser and see the image, that's the path you need. – Abe Aug 13 '22 at 18:05
-
@Abe i am edited this question kindly help me to sole this – Durgadevi Aug 18 '22 at 08:33
-
@AnandhKrishnan no still not solved – Durgadevi Aug 18 '22 at 08:34
-
iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVQYV2NgYAAAAAMAAWgmWQ0AAAAASUVORK5CYII= – Anand Aug 18 '22 at 09:18
-
instead of source try the above base 64 – Anand Aug 18 '22 at 09:18
-
check now whether works or not – Anand Aug 18 '22 at 09:18
-
@Durgadevi your base 64 is not an image its a text, how can u view as a image – Anand Aug 18 '22 at 09:22
-
@AnandhKrishnan tried using your base64 value but not image shown. – Durgadevi Aug 19 '22 at 10:33
-
It will be a empty image – Anand Aug 19 '22 at 10:34
-
if my base64 value is an text then how to change as a image – Durgadevi Aug 19 '22 at 10:35
-
You can't change as image – Anand Aug 19 '22 at 10:37
-
if ur value is text , just create a text field and assign your base 64 value to that string – Anand Aug 19 '22 at 10:38
-
Did u solve the issue ? – Anand Aug 19 '22 at 11:52
1 Answers
0
As your converted Base64
not an image
, You cannot convert into image.
Your Base 64 is text
. So you just create a text field
and assign the value to it.

Anand
- 4,355
- 2
- 35
- 45
-
your answer is correct but i want to view as a image not a text. this data stored in backend (mongodb using gridfs in nodejs). – Durgadevi Aug 22 '22 at 05:19
-
-
{"bucketName": "documents", "chunkSize": 261120, "contentType":"image/png", "encoding": "7bit", "fieldname": "Files", "filename":"profile5.png", "id": "62e8c15571dc52ad4c47de2c", "md5": null,"metadata": null, "mimetype": "image/png", "originalname": "profile5.png", "size": 10072, "uploadDate":"2022-08-02T06:16:54.079Z"} if its my profile image i want to display this in my app as a image – Durgadevi Aug 22 '22 at 06:58
-
For that you need to check your base64 file type, if your base64 is text then set into textfield if your base 64 is an image you should set into iamgeview – Anand Aug 22 '22 at 07:04
-
-