Processing code for extracting binary images from a database using php
Source: Internet
Author: User
The format is similar to that of UCH, but the storage method is different. I am stupid. this problem is confusing. I hope to help the experts in phper with the same problem for a long time! Image. php file
The code is as follows:
$ Conn = @ mysql_connect ("localhost", "root", "123") or die ("server connection error! "); // Link to the database
@ Mysql_select_db ("upload", $ conn) or die ("no database 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;
?>
Above is image extraction
Foreground files
The code is as follows:
">
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.
A Free Trial That Lets You Build Big!
Start building with 50+ products and up to 12 months usage for Elastic Compute Service