2011-02-26 142 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 
相关问题