MySQL中存放图像应该用Blob类型的数据类型。参考步骤如下: 1. 生成一个基本的表Images来存放图片 create table Images (PicNum int not null auto本文来源gaodai$ma#com搞$$代**码)网8_increment primary key, image BLOB); 2. 建立上载脚本,完成的功能是取得图片文件并把文件插入数据库,假定
MySQL中存放图像应该用Blob类型的数据类型。参考步骤如下:
1. 生成一个基本的表Images来存放图片
create table Images (PicNum int not null auto_increment primary key, image BLOB);
2. 建立上载脚本,完成的功能是取得图片文件并把文件插入数据库,假定放文件名的列是Picture脚本见下图(点击放大)
498)this.width=498;’ onm ousewheel = ‘javascript:return big(this)’ height=300 alt=”” src=”https://img.gaodaima.com/d/file/2019/04/15/15397d450cdc76e338a96b73d8f35136.gif” width=500 border=0>
3. 以上脚本可能会出现无法插入的报错信息,请参考MySQL的max packet allowed设置,在错误日志中可以查到。
4. 以下的脚本将显示出插入的图片
498)this.width=498;’ onm ousewheel = ‘javascript:return big(this)’ height=300 alt=”” src=”https://img.gaodaima.com/d/file/2019/04/15/bdb07f7aee10742d336492948d81d85f.gif” width=500 border=0> (点击放大)
5. 输入任意的PicNum号来调出图片的php脚本
498)this.width=498;’ onm ousewheel = ‘javascript:return big(this)’ height=156 alt=”” src=”https://img.gaodaima.com/d/file/2019/04/15/ab57b410dba418d6d3145225aa38b61c.gif” width=655 border=0>(完)