We are using a package to create and make pdf download called Dompdf (https://github.com/barryvdh/laravel-dompdf).
In some time, we needed to display the company image logo inside pdf report. we did everything we could and it did not working.
In the other words, convert image to base64.
Make sure that option "isPhpEnabled" is true
$pdf = \App::make('dompdf.wrapper');
$pdf->setOptions(['isRemoteEnabled' => true, 'isHtml5ParserEnabled' => true, 'isPhpEnabled' => true]);
@php
$path = $media->getPath();
$type = pathinfo($path, PATHINFO_EXTENSION);
$data = file_get_contents($path);
$base64 = 'data:image/' . $type . ';base64,' . base64_encode($data);
@endphp
<img src="{{$base64}}"/>
Reference: spatie/laravel-medialibrary#1269 (comment)