Join the Stack Overflow Community
Stack Overflow is a community of 6.3 million programmers, just like you, helping each other.
Join them; it only takes a minute:
Sign up

In my Ionic App, I have a Laravel webservice that is pulling an image file from AWS S3. The S3 bcuket is secured with an IAM user. Therefore just by simply pointing to the http://S3URL/bucket/imagename.jpg would not work. Instead my API returns a binary stream. I tried converting the binary stream into an image that can be displayed by using the following:

 $scope.receiptdata = response.data; // (response from My web service)
 var basestring = "data:image/png;base64,";
 $scope.newreceipt = basestring + $scope.receiptdata;

And then in my view

However, I received a blank view. I have tested the view with another static image by pointing to a remote url and I know for a fact that it works. Is there a way to display the the image. I am trying not to do away with all the security in my S3 bucket as the images are specific to the users and I don't want other than the user who owns it to own it.

share|improve this question
    
So basically the proble with your conversion, near converting the binary stream into an image right ? – Jigar7521 yesterday
    
that is correct @Jigar7521 – Joti Basi yesterday
    
are you using ajax for to retrieve data of image? – Jigar7521 yesterday
    
@Jigar7521- no It is an ionic / angularjs script. I am using http.get to make a rest call to my API server which calls S3 to fetch the file. $file = Storage::disk('s3')->get('filename'); – Joti Basi yesterday
    
Ok so i think before to get response from your API call, it is not waiting till, and continuing execution ahead, that's why it happening – Jigar7521 yesterday

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.