Im trying to resize and display an image from my MySQL database. Im able to display the image but when I try to put it in a table or size it, it shows no image. I attached a screen shot of what I get when I try to add any style to it.screenshot If I display it with no style it works fine. Below is the my code.
<?php
if(!empty($_GET['id'])){
//DB details
$dbHost = 'localhost';
$dbUsername = 'user';
$dbPassword = 'pswd';
$dbName = 'db';
//Create connection and select DB
$db = new mysqli($dbHost, $dbUsername, $dbPassword, $dbName);
//Check connection
if($db->connect_error){
die("Connection failed: " . $db->connect_error);
}
//Get image data from database
$result = $db->query("SELECT receipt FROM Expense WHERE id = {$_GET['id']}");
if($result->num_rows > 0){
$imgData = $result->fetch_assoc();
//Render image
header("Content-type: image/jpeg");
echo "<tr>
<td>".$imgData['receipt']."</td>
</tr>";
}else{
echo 'Image not found...';
}
}
?>