Home  >  Article  >  Backend Development  >  Decimal to binary PHP processing code for extracting binary images from the database

Decimal to binary PHP processing code for extracting binary images from the database

WBOY
WBOYOriginal
2016-07-29 08:40:451223browse

image.php file

Copy code The code is as follows:


$c or die("Server connection error!"); //Link to database
@mysql_select_db("upload",$conn ) or die("Database not found!");
$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;
?>


The above is the image extraction
Front display file

Copy the code The code is as follows:



The above introduces the decimal to binary PHP processing code for extracting binary images from the database, including the content of decimal to binary conversion. I hope it will be helpful to friends who are interested in PHP tutorials.

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