Home >php教程 >php手册 >分享 php 将图片转为数据流入库还原操作

分享 php 将图片转为数据流入库还原操作

WBOY
WBOYOriginal
2016-06-06 19:46:051075browse

?php $Picture = './all-index-right-pic0.jpg'; If($Picture != none) { $PSize = filesize($Picture); $mysqlPicture = fread(fopen($Picture, r), $PSize); //可将 $mysqlPicture 存入数据库,当然字段的是2进制的 //读取出来的还原操作,和验证码的实现机


$Picture = './all-index-right-pic0.jpg';


If($Picture != "none") {
$PSize = filesize($Picture);
$mysqlPicture = fread(fopen($Picture, "r"), $PSize);
//可将 $mysqlPicture 存入数据库,当然字段的是2进制的

 

//读取出来似的还原操作,和验证码的实现机制差球不多啊

Header( "Content-type: image/gif");
echo $mysqlPicture;

}else {
echo"You did not upload any picture";
}

?>

 

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn