Как мать дисплее изображений из MySQL перепробовала очень много решений не похоже на работу...
following is the code i used to display image from database which is in longblob format. im getting output like this https://i.stack.imgur.com/RDkdM.png one more thing i can see image by downloading it from phpmyadmin and saving it in jpeg format.
Что я уже пробовал:
1.
<?php $id = $_GET['id']; $servername = "localhost"; $username = "root"; $password = ""; $dbname = "photost"; $conn=mysqli_connect($servername, $username, $password, $dbname); if (!$conn) { die("Connection failed: " . mysqli_connect_error()); } $query="SELECT * FROM `images` WHERE `id`=$id"; $result =mysqli_query($conn, $query); $row = mysqli_fetch_assoc($result); $image =$row['image']; /** check if the image is db */ if($image!=null) { $db_img = imagecreatefromstring($image); Header("Content-type: image/jpeg"); imagejpeg($db_img); } mysql_close($conn); ?>
2.
$row = mysql_fetch_assoc($result); header("content-type: image/jpeg"); echo $row['image']; mysql_close($conn);
выход
[^]