Php 在jQuery插件中从数据库中显示图像:Gallerific

Php 在jQuery插件中从数据库中显示图像:Gallerific,php,jquery,database,image,Php,Jquery,Database,Image,我正在使用jQuery插件-Gallerific() 我还将学习本教程: 好的,图像现在在数据库中,但我无法使用以下方法查看数据库中的图像: <img src="getpicture.php?fid=1"> 我在这里遗漏了什么?是否将标题设置为 标题(“内容类型:图像/jpeg”) 要进行测试,请调用URL getpicture.php?fid=1 看看会发生什么 编辑:在步骤5中 <? if(isset($_GET['fid'])) { // connect to t

我正在使用jQuery插件-Gallerific()

我还将学习本教程:

好的,图像现在在数据库中,但我无法使用以下方法查看数据库中的图像:

<img src="getpicture.php?fid=1">


我在这里遗漏了什么?

是否将标题设置为
标题(“内容类型:图像/jpeg”)

要进行测试,请调用URL

getpicture.php?fid=1
看看会发生什么

编辑:在步骤5中

<?
if(isset($_GET['fid']))
{
// connect to the database
include "connect.php";

// query the server for the picture
$fid = $_GET['fid'];
$query = "SELECT * FROM files WHERE fid = '$fid'";
print $query;
$result  = mysql_query($query) or die(mysql_error());
print_r($result);

// define results into variables
$name=mysql_result($result,0,"name");
$size=mysql_result($result,0,"size");
$type=mysql_result($result,0,"type");
$content=mysql_result($result,0,"content");
print "check point 1 => $name, $size, $type, $content";
// give our picture the proper headers...otherwise our page will be confused
header("Content-Disposition: attachment; filename=$name");
header("Content-length: $size");
header("Content-type: $type");
echo $content;

mysql_close();
}else{
die("No file ID given...");
}

?> 

getpicture.php上的

  • 获取图像的id
  • 查询数据库
  • 标题后回显图像(“内容类型:image/jpeg”)

  • 我已经像你说的那样设置了标题,我测试了url,但是没有显示任何内容