最新下载
热门教程
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
显示保存在mysql数据库中图片代码
时间:2022-06-24 19:12:05 编辑:袖梨 来源:一聚教程网
代码如下 | 复制代码 |
header( "content-type:image/gif "); include( "../inc/conn.php教程 "); mysql_select_db( "ce_cdprog ",$db); $rs=mysql_query( "select * from pic where id=$id "); $row=mysql_fetch_array($rs); echo $row[ "mc "]; |
//方法二
代码如下 | 复制代码 |
while (($row=$results->fetch_assoc()) !==null) { header( "Content-type:{$row['image_type']}"); echo $row['image']; imagedestroy($img); } |
//图片保存到数据库
代码如下 | 复制代码 |
move_uploaded_file($_FILES['imagefile']['tmp_name'],"latest.img"); $instr = fopen("latest.img","rb"); $image = addslashes(fread($instr,filesize("latest.img"))); if (strlen($instr) < 149000) { mysql_query ("insert into pix (title, imgdata) values ("". $_REQUEST[whatsit]. "", "". $image. "")"); } else { $ |
errmsg = "Too large!";
}
相关文章
- 碧蓝航线大型作战装备研发优先级攻略 04-30
- 我的勇者游侠怎么搭配最强 04-30
- 仙剑世界照影迷妄镜任务流程完整解析 04-30
- CF手游王者风神保底价格攻略 04-30
- 明日之后前期装备推荐依据分享 04-30
- 明日之后菊花瓣食谱怎样 04-30