如何显示从数据库中检索到的图像? [英] how to display image that is retrieved form database?

查看:56
本文介绍了如何显示从数据库中检索到的图像?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我知道如何检索图像以外的数据

i know how to retrieve data other than image

$q="select name from brands";
$q_rs = $this->db->query($q);
$result = $q_rs->result();
foreach($result as $i)
{
    foreach($i as $j)
        echo $j."<br>";
}



但是,如果我尝试通过这种方法显示检索到的图像,则屏幕上会显示很多原始数据而不是图像.我在Google上搜索了一下,并了解到应该编写一个标头,以告诉浏览器该数据是图像.以下是我编辑的代码,但未显示静止图像,出现带有十字的框



but if i try to display the retrieved image by this method, lot of raw data display on the screen not image. i google it and learn that a header should be written that tell the browser that the data is an image. below is my edited code but still image is not displaying, a box with a cross is appearing

$q="select image from brands";
$q_rs = $this->db->query($q);
$result = $q_rs->result();
header("Content-type: image/jpeg");
foreach($result as $i)
{
    foreach($i as $j)
        echo $j."<br>";
}

推荐答案

q = "
q="select name from brands";


q_rs =
q_rs =


this-> db-> query(
this->db->query(


这篇关于如何显示从数据库中检索到的图像?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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