JSFiddle - React, Tailwind, and code Playground

by anil001ry

HTML

<script src="https://cdnjs.cloudflare.com/ajax/libs/aws-sdk/2.2.9/aws-sdk.min.js"></script>

<section ng-app data-ng-controller="myCtrl">
    <img  ng-src="{{s3base}}{{s3url}}" id="myimg">
</section>

JavaScript

function myCtrl($scope,$timeout) {    
$scope.s3base = "https://isl-ldesigner.s3.ap-south-1.amazonaws.com"
    AWS.config.update({
  accessKeyId: 'AKIAJKOCJS3ZKDATZWDA', secretAccessKey: '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'});
    AWS.config.region = "ap-south-1";
    
var bucket = new AWS.S3({params: {Bucket: 'isl-ldesigner'}});
    
    bucket.getObject({Key: '/alsimages/AEYLQHCE.jpg'},function(err,file){
        
   
        $timeout(function(){
        $scope.s3url = "data:image/jpeg;base64," + encode(file.Body);
    },1);
    
});
}

function encode(data)
      {
          var str = data.reduce(function(a,b){ return a+String.fromCharCode(b) },'');
          return btoa(str).replace(/.{76}(?=.)/g,'$&\n');
      }