Home > Backend Development > PHP Tutorial > Display image code saved in mysql database_PHP tutorial

Display image code saved in mysql database_PHP tutorial

WBOY
Release: 2016-07-13 17:04:25
Original
1165 people have browsed it

Display the image code saved in the mysql tutorial database tutorial

header( "content-type:image/gif ");
include( "../inc/conn.php tutorial ");
mysql_select_db( "ce_cdprog ",$db);
$rs=mysql_query( "select * from pic where id=$id ");
$row=mysql_fetch_array($rs);
echo $row[ "mc "];

//Method 2

while (($row=$results->fetch_assoc()) !==null)
{
header( "Content-type:{$row['image_type']}");
echo $row['image'];
imagedestroy($img);
}

//Save the image to the database

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!";
}

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/630853.htmlTechArticleDisplay the image code saved in the mysql tutorial database tutorial header( content-type:image/gif ); include( . ./inc/conn.php tutorial); mysql_select_db( ce_cdprog ,$db); $rs=mysql_query( sele...
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template