php 從數(shù)據(jù)庫提取二進(jìn)制圖片的處理代碼
更新時間:2009年09月09日 21:57:49 作者:
形式上類似UCH 只是存儲方式不一樣 本人比較愚鈍 這個問題困惑了我半天 希望對有同樣問題的phper有所幫助 高手們別見笑!
image.php文件
<?php
$conn=@mysql_connect("localhost","root","123") or die("服務(wù)器連接錯誤!"); //鏈接數(shù)據(jù)庫
@mysql_select_db("upload",$conn) or die("未發(fā)現(xiàn)數(shù)據(jù)庫!");
$query="select * from upfile where ftag=$fn";
$result=mysql_query($query);
if(!$result) die("error: mysql query");
$num=mysql_num_rows($result);
if($num<1) die("error: no this recorder");
$data = mysql_result($result,0,"picture");
header("Content-type: image/JPEG",true);
echo $data;
?>
上面是圖片提取
前臺顯示文件
<img src="image.php?fn=<?php echo $fn;?>">
復(fù)制代碼 代碼如下:
<?php
$conn=@mysql_connect("localhost","root","123") or die("服務(wù)器連接錯誤!"); //鏈接數(shù)據(jù)庫
@mysql_select_db("upload",$conn) or die("未發(fā)現(xiàn)數(shù)據(jù)庫!");
$query="select * from upfile where ftag=$fn";
$result=mysql_query($query);
if(!$result) die("error: mysql query");
$num=mysql_num_rows($result);
if($num<1) die("error: no this recorder");
$data = mysql_result($result,0,"picture");
header("Content-type: image/JPEG",true);
echo $data;
?>
上面是圖片提取
前臺顯示文件
復(fù)制代碼 代碼如下:
<img src="image.php?fn=<?php echo $fn;?>">
您可能感興趣的文章:
- php實現(xiàn)上傳圖片保存到數(shù)據(jù)庫的方法
- php上傳圖片存入數(shù)據(jù)庫示例分享
- php上傳圖片到指定位置路徑保存到數(shù)據(jù)庫的具體實現(xiàn)
- php中如何將圖片儲存在數(shù)據(jù)庫里
- php下將圖片以二進(jìn)制存入mysql數(shù)據(jù)庫中并顯示的實現(xiàn)代碼
- php將圖片保存入mysql數(shù)據(jù)庫失敗的解決方法
- php將圖片文件轉(zhuǎn)換成二進(jìn)制輸出的方法
- php圖片的二進(jìn)制轉(zhuǎn)換實現(xiàn)方法
- PHP實現(xiàn)上傳圖片到數(shù)據(jù)庫并顯示輸出的方法
相關(guān)文章
php站內(nèi)搜索并高亮顯示關(guān)鍵字的實現(xiàn)代碼
將sql語句中包含的%$info%交給DBMS執(zhí)行的時候,他會查找字段中含有變量$info的值的信息2011-12-12
淺析php中三個等號(===)和兩個等號(==)的區(qū)別
以下是對php中三個等號(===)和兩個等號(==)的區(qū)別進(jìn)行了詳細(xì)的分析介紹,需要的朋友可以過來參考下2013-08-08
PHP簡單實現(xiàn)“相關(guān)文章推薦”功能的方法
這篇文章主要介紹了PHP簡單實現(xiàn)“相關(guān)文章推薦”功能的方法,方法簡單功能實用,需要的朋友可以參考下2014-07-07
ThinkPHP使用心得分享-ThinkPHP + Ajax 實現(xiàn)2級聯(lián)動下拉菜單
聯(lián)動菜單的數(shù)據(jù)存在數(shù)據(jù)庫,可以隨時通過對數(shù)據(jù)庫添加刪除修改改變菜單數(shù)據(jù),而不需修改代碼,同時,實現(xiàn)了2級后,也可以實現(xiàn)3級,4級。。。等關(guān)聯(lián)菜單2014-05-05
PHP編碼規(guī)范-php coding standard
標(biāo)準(zhǔn)化問題在某些方面上讓每個人頭痛,讓人人都覺得大家處于同樣的境地。這有助于讓這些建議在許多的項目中不斷演進(jìn),許多公司花費了許多星期逐子字逐句的進(jìn)行爭論。2007-03-03

