Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Fetch image from S3 Bucket using React JS

I have been trying to fetch an image from the s3 bucket to my react UI, my app is made of laravel and react, So I was able to activate the s3 for laravel, and it worked as I was able to render the images to admin end.

Now back to frontend which is made of react, I've been finding it difficult to do, I have installed

  "@aws-amplify/storage": "^1.1.2",
        "aws-amplify": "^1.1.40",
        "aws-amplify-react": "^2.4.4",
        "aws-config": "^1.3.2",

Please I really need help

like image 777
Folorunso Avatar asked Sep 17 '25 07:09

Folorunso


2 Answers

i faced the same problem and solved the issue

<Image src={'http://innopizza.s3-eu-west-2.amazonaws.com/abc.jpg'} />

<img src={https://bucketname.s3.us-east-2.amazonaws.com/foldername/filename.png} alt="image"/>

-the bucket and it's all object must be public

-exact access link of your object is "objecturl" on aws platform

like image 40
Jain Priyank Avatar answered Sep 19 '25 10:09

Jain Priyank



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!