0
我使用jQuery的plugin- Galleriffic(link here)diplaying圖像jQuery插件:Galleriffic
而且我也按照本教程:Upload Files To Database
好,圖像現在在數據庫但我無法看到使用這個從數據庫中的圖像:
<img src="getpicture.php?fid=1">
缺少什麼我在這裏?
我使用jQuery的plugin- Galleriffic(link here)diplaying圖像jQuery插件:Galleriffic
而且我也按照本教程:Upload Files To Database
好,圖像現在在數據庫但我無法看到使用這個從數據庫中的圖像:
<img src="getpicture.php?fid=1">
缺少什麼我在這裏?
你設置頭 header("Content-Type: image/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
header("Content-Type: image/jpeg")
如你所說,我設置了標題中的形象,我測試的URL,但沒有出現 – woninana 2011-04-15 05:53:31
看到我上面的編輯。 – 2011-04-15 06:00:32