2017-02-26 121 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

哦,非常感謝你的工作 –