i want show picture in code reason big white blank page broken link img. want show image , along other information. want resize image(so doesnt cover whole page). code:
<?php session_start() ?> <!doctype html> <html> <head> <meta charset="utf-8" /> <meta name="viewport" content="initial-scale=1.0" /> <link rel="stylesheet" href="css/style.css" /> </head> <div id="container"> <div id="header"> <h1>welcome!</h1> </div> <div id="navigation"> <?php include_once "navigation.php"; ?> </div> <div id="content"> <?php if (isset($_get['search'])) { $name = $_get['search']; mysql_connect("localhost","root","") or die ("could not connect server!"); mysql_select_db("pictures") or die ("that database not found!"); $query = mysql_query("select * picture name='$name'") or die ("the query not completed, please try again later!"); if (mysql_num_rows($wepquery) !=1) { die ("that name not found!"); } while ($row = mysql_fetch_array($query, mysql_assoc, 0)) { $dbname = $row['name']; $dbcreator = $row['creator']; $dbdescription = $row['description']; $imagedata = $row['image']; } header("content-type: image/jpeg"); if($name != $dbname) { die ("there has been fatal error. please try again."); } ?> <h2><?php echo $name; ?></h2> <br /> <table> <tr><td>creator: <?php echo $dbcreator;?></td></tr> <tr><td>description:<br /><?php echo $dbdescription;?></td></tr> <tr><td>picture:<br /><?php echo $imagedata;?></td></tr> </table> <?php } else die ("you need specify submission!"); ?> </div> </div> </html>
the database:
id, name, creator, description, image_name, image(mediumblob).
the last 2 fields can see dedicated pictures. yes know pdo , mysqli, want finish code first. help?
images need either served url or blob needs converted data uri so:
<table> <tr><td>creator: <?php echo $dbcreator;?></td></tr> <tr><td>description:<br /><?php echo $dbdescription;?></td></tr> <tr><td>picture:<br /><?php echo "<img src='data:image/jpeg;base64," . base64_encode( $imagedata ) . "' />"; ?></td></tr> </table>
Comments
Post a Comment