Php 如何在laravel 5.3中解码base64

Php 如何在laravel 5.3中解码base64,php,laravel,api,base64,laravel-5.3,Php,Laravel,Api,Base64,Laravel 5.3,我正在为移动应用程序开发一个API,从移动端我以base64格式获取图像,并将其插入我的数据库的profile\u image列中 在我的网络中,我想显示那个图像,那么我如何解码它呢 <div class="card horizontal card-driver-details"> <div class="card-image card-circular"> <img src="{{ $driver->profile_image}} "

我正在为移动应用程序开发一个API,从移动端我以
base64
格式获取图像,并将其插入我的
数据库的
profile\u image
列中

在我的网络中,我想显示那个图像,那么我如何解码它呢

<div class="card horizontal card-driver-details">
    <div class="card-image card-circular">
        <img src="{{ $driver->profile_image}} "> //i want to display here
    </div>
    <div class="card-stacked">
        <div class="card-content">
            <p><b>Name:</b>{{ $driver->first_name }} {{ $driver->last_name }}</p>
            <p><b>Phone:</b>{{ $driver->phone_number }}</p>
            <p><b>Address:</b>{{ $driver->addess_city_village }} {{ $driver->address_state }}</p>
        </div>
    </div>
</div>

profile_image}“>//我想在这里显示
姓名:{{$driver->first_Name}{{$driver->last_Name}

电话:{{$driver->Phone_number}

地址:{{$driver->addess_city_village}{{$driver->Address_state}

谢谢

试试看

base64_decode($driver->profile_image);
试一试

试试这个:

$image = base64_decode('base_64_image_string');
$fp = fopen('path_to_where_you_want_to_save_image','wb+');
fwrite($fp,$image);
fclose($fp);
试试这个:

$image = base64_decode('base_64_image_string');
$fp = fopen('path_to_where_you_want_to_save_image','wb+');
fwrite($fp,$image);
fclose($fp);
试试这个

{{ base64_decode($driver->profile_image) }}
这将使用base 64解码
配置文件\u图像
,然后打印结果。

试试这个

{{ base64_decode($driver->profile_image) }}

这将使用base 64解码
配置文件\u图像
,然后打印结果。

我尝试使用以下代码,但不起作用

base64_decode($driver->profile_image);
然后浏览了一下,然后找到了所有更新的浏览器 支持
数据:image/jpeg/png/gif/etc

现在我可以显示图像了

$driver->profile_image

我尝试了以下代码,但不起作用

base64_decode($driver->profile_image);
然后浏览了一下,然后找到了所有更新的浏览器 支持
数据:image/jpeg/png/gif/etc

现在我可以显示图像了

$driver->profile_image

所有类型的文件都可以通过使用此

  $image_64 = $data['photo_url']; //your base64 encoded data

  $extension = explode('/', explode(':', substr($image_64, 0, strpos($image_64, ';')))[1])[1];   // .jpg .png .pdf

  $replace = substr($image_64, 0, strpos($image_64, ',')+1); 

// find substring fro replace here eg: data:image/png;base64,

 $image = str_replace($replace, '', $image_64); 

 $image = str_replace(' ', '+', $image); 

 $imageName = Str::random(10).'.'.$extension;

 Storage::disk('public')->put($imageName, base64_decode($image));

所有类型的文件都可以通过使用此

  $image_64 = $data['photo_url']; //your base64 encoded data

  $extension = explode('/', explode(':', substr($image_64, 0, strpos($image_64, ';')))[1])[1];   // .jpg .png .pdf

  $replace = substr($image_64, 0, strpos($image_64, ',')+1); 

// find substring fro replace here eg: data:image/png;base64,

 $image = str_replace($replace, '', $image_64); 

 $image = str_replace(' ', '+', $image); 

 $imageName = Str::random(10).'.'.$extension;

 Storage::disk('public')->put($imageName, base64_decode($image));

到目前为止,您自己做了哪些尝试?可能在“html img base64”(相关:)的行中询问[您选择的搜索引擎]一些内容,您自己做了哪些尝试?可能在“html img base64”(相关:)的行中询问[您选择的搜索引擎]一些内容谢谢你的时间,没有回应谢谢你的时间,没有回应谢谢你的时间,我不想储存图像只想解码和显示谢谢你的时间,我不想储存图像只想解码和显示节省了我的一天,非常感谢你节省了我的一天,非常感谢