php - Stored image in database doesn't show on page -


image stored in database (as varchar(255)), on page isn't shown.

this code stored image, , put's image in folder:

if (isset($_files["image"])) {     $title = date("dmyhms") . "_" . $_files["image"]["name"];     $path = "img/profile/" . $_post["id"] . "_" . $title;     move_uploaded_file($_files["image"]["tmp_name"], $path);  } 

and display image:

foreach ($conn->results() $conn):     $img = $_server["context_document_root"] . $path . "img/profile" . $conn->id . "_" . $conn->image;     if (file_exists($img)) {     $image = $path . "img/profile/" . $conn->id . "_" . $conn->image;     } else {     $image = $path . "img/noimage.png";     } <?php endforeach; ?> 

when print_r $img, shows right path image , still image not displayed.

display:

<?php echo $image; ?> 

where did echoing image? if inside foreach, need change code little bit...

$image = '<img src="'.$path . "img/profile/" . $conn->id . "_" . $conn->image . '" />'; 

hope, work you.... tq


Comments

Popular posts from this blog

c# - Better 64-bit byte array hash -

webrtc - Which ICE candidate am I using and why? -

php - Zend Framework / Skeleton-Application / Composer install issue -