图片不显示 reactjs laravel

Image not displaying reactjs laravel

我想从 laravel 存储中获取图像并在 React js 中显示它

<img src={getImage(item.path)} />

getImage函数

const getImage = (path) => {
    const di = axios.get("http://localhost:8000/api/"+path)
        .then(res => {
          return res.data;
        });
    return URL.createObjectURL(new Blob([di]));
}

我的laravel控制器功能

public function download($image)
    {
        $path = "mail/{$image}";
        if(Storage::exists($path)){
            $file = Storage::download($path);
            return Response::make($file, 200);
        }
    }

我得到的

请帮我找到解决方案我从这周开始就有这个问题

你应该return这样

return response()->file($file, $headers);