意见的base64 EN codeD一滴在HTML中使用PHP [英] Views base64 encoded blob in HTML with PHP

查看:123
本文介绍了意见的base64 EN codeD一滴在HTML中使用PHP的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有一点麻烦Im的试图查看一个base64连接这是我的持有服务器作为一个blob上codeD映像。我要查看这里面要么添加图片或回声它作为我可以用图像标记引用到HTML文件。

having a bit of trouble Im trying to view a base64 encoded image which is held on my server as a blob. I want to view this inside either with an image tag or echo it as an html file which I can reference to with an image tag.

问题是BLOB数据返回从我的服务器错误。

The problem is the blob data returns wrong from my server.

    <?php

       $select = "SELECT `data` 
               FROM  `sandbox`.`photos` 
               WHERE `id` = 4
               LIMIT 0 , 1";

        $result = mysql_query($select, $connection);



         while($row = mysql_fetch_array( $result )){

           $blob_data = $row[0];

           echo "$blob_data";

           }

    ?>

的问题是,这retuns 5.533782782 * E

The problem is that this retuns 5.533782782 * E.

我如何认为这是一个形象呢?我需要DEEN code呢?

How do I view this as an image? Do I need to deencode it?

推荐答案

试试这个:

echo '<img src="data:image/png;base64,'.base64_encode($blob_data).'">';

这篇关于意见的base64 EN codeD一滴在HTML中使用PHP的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆