@toufik94 You can get the content of the image by file_get_contents PHP function. In your API controller you can stream this content.
Dec 14, 2022
4
Level 1
How to serve image of external source over a Laravel API
Hi guys,
The question is simple: I have a file from an external source, lets say my Azure Blob Storage called ''www.externalwebsite.com/test.jpg". I want to create an API to display the content from that url via my own defined API which could be "www.localhost:8000/api/image/test.jpg".
I want that API-url to be used for the 'src' attribute of my HTML image tag.
What is the best way to do this without first saving the image locally or in some kind of cache?
Please or to participate in this conversation.