2017-02-26 49 views
-1

我从数据库中读取图片时遇到此问题。Image nut从数据库中读取Php

它显示了这样的:

enter image description here

此我的代码:

<?php 
include 'Header.php'; 
include 'yzd.php'; 
?> 

<div class="container"> 
<h1> All Project - Youne Zaidi </h1> 
<?php 
$posts = mysqli_query($db_connect,"select * from Project order by id desc"); 

while($post = mysqli_fetch_array($posts)){ 
    echo " 
    <article> 
    <a href='Project.php?id=$post[id]'> 
    <h1>$post[NameProject]</h1> 
    </a> 
    <p class='text-muted']> 
    <h3>$post[TypeProject]</h3> 
    </p> 
    <h4>$post[Description]</h4> 

    $post[Pic]; 

    <p>-----------------------------------------------------------------------------</p> 
    </article>"; 

} 
?> 

enter image description here

+2

如果您打算发布代码图片,请不要期待太多帮助 –

+0

您好!看起来好像你的问题写得很差。它的方式是,它只会吸引downvotes,并没有答案。 –

+0

不要将实际图像存储在数据库中,存储其位置。 – DevDonkey

回答

2

尝试的原始图像输出变换成基64个数据URI (see here) 你可以能够通过更改

来做到这一点
$post[Pic] 

<img src='".'data:image/png;base64,' . base64_encode($post["Pic"])."'/> 

鉴于所有在数据库中的图像被作为stroed PNG(多个)的类型可能需要改变取决于图像类型。

请将来使用代码片段而不是截图。

+0

哦,非常感谢你的工作 –