Get Image from Database with php mysql -


i trying image database use following code:

  <?php        $image_qry=mysqli_query($mysqli,"select * benutzer");     $image=mysqli_fetch_assoc($image_qry);     $get_image=$image['profilbild']; //this should contain picture     header("content-type: image/jpeg");      echo $get_image;      ?> 

here database structure:

users

please me , tell me how can output picture in commun <div> element

instead of storing image inside of database create upload folder store image name database , when want call add name @ end.

<?php        $image_qry=mysqli_query($mysqli,"select * benutzer");     $image=mysqli_fetch_assoc($image_qry);      $link = directory of image;     $get_image=$link.$image; //this should contain picture      echo file_get_contents($get_image); ?> 

upload script:

$target_dir = "uploads/"; $target_file = $target_dir . basename($_files["filetoupload"]["name"]); $uploadok = 1; $imagefiletype = pathinfo($target_file,pathinfo_extension); // check if image file actual image or fake image if(isset($_post["submit"])) {     $check = getimagesize($_files["filetoupload"]["tmp_name"]);     if($check !== false) {         echo "file image - " . $check["mime"] . ".";         $uploadok = 1;     } else {         echo "file not image.";         $uploadok = 0;     } } 

reference:

http://www.w3schools.com/php/php_file_upload.asp


Comments