public static function getRawImage($path)
    {
        $disk = config('filesystems.default');

        /** @var \Illuminate\Filesystem\FilesystemAdapter $storage */
        $storage = Storage::disk($disk);

        // Check that the path is valid
        if (! $storage->exists($path)) {
            return '';
        }

        // Fetch the raw data from the storage
        $mime_type = $storage->mimeType($path);
        $raw_image = "data:$mime_type;base64," . base64_encode($storage->get($path));
        return $raw_image;
    }
public static function getRawImage($path)
    {
        $disk = config('filesystems.default');

        /** @var \Illuminate\Filesystem\FilesystemAdapter $storage */
        $storage = Storage::disk($disk);

        // Check that the path is valid
        if (! $storage->exists($path)) {
            return '';
        }

        // Fetch the raw data from the storage
        $mime_type = $storage->mimeType($path);
        $raw_image = "data:$mime_type;base64," . base64_encode($storage->get($path));
        return $raw_image;
    }
public static function getRawImage ( $ path ) { $ disk = config ( 'filesystems.default' ) ; /** @var \Illuminate\Filesystem\FilesystemAdapter $storage */ $ storage = Storage :: disk ( $ disk ) ; // Check that the path is valid if ( ! $ storage -> exists ( $ path ) ) { return '' ; } // Fetch the raw data from the storage $ mime_type = $ storage -> mimeType ( $ path ) ; $ raw_image = "data:$mime_type;base64," . base64_encode ( $ storage -> get ( $ path ) ) ; return $ raw_image ; }
Get raw image attribute based on its path on file storage

@param $path string
@return string
Get raw image attribute based on its path on file storage