2011-02-26 170 views

回答

2
<?php 
$image = $row['myimage']; 
header("Content-type: image/gif"); 
print $image; 
exit; 
>? 

但它似乎更容易只是存儲路徑...

+0

它顯示這些代碼給我 ç\t \t T 「\t }!1AQa」 Q2#BR $ 3房 – user1400 2011-02-26 08:38:04

+0

是U存儲什麼類型的圖像?您需要用適當的類型替換GIF。 – diagonalbatman 2011-02-26 10:59:54

+0

我將jpeg文件存儲在我的表格中 – user1400 2011-02-26 11:18:01

0

這個概念有點類似下面的代碼,其中img1.jpg是圖像文件

$handle = fopen('img1.jpg', 'r'); 

header("Content-type: image/gif");//make sure that you dont have output before it 

echo fread($handle, filesize('img1.jpg')); 

並嘗試爲下一個實驗

$handle = fopen('img1.jpg', 'r'); 

echo fread($handle, filesize('img1.jpg')); 
//If you are storing the output of this in 
//your db then this should work 
//however it is best recommended to store 
//path which makes you jog a lot easir 

//if you get the same error then you have error in 
//storing your file 
相關問題