$location = Storage::disk('public')->url(Post::first()->poster); $image = Image::make($location)->encode()->encoded; base64_encode($image);
How to get plain base64 encoded image format in Laravel
573
3 years ago
0 comments
To get a plain base64 image format in Laravel you can make use of the Laravel Intervention package. The steps are very simple which you only have to call the "encode()" method and access the "encoded" property.
By doing so the image that's returned is plain base64 format. If you want to get the formatted base64 format that you can straight away attach to an image tag, you can refer to the previous code snippets on Intervention Image encode image to base64 format in Laravel
Topics:
Frontend
Resource
Average
Average
Support Us
If you like our tutorial, support us by being our Patreon or buy us some coffee ☕️
Leave a reply