You need to create a PHP script that will get an image based on it's unique ID, lets call it imageId for the sake of this answer, and lets pretend like this is in a PHP file called image.php. This would look something like:
$query = "SELECT * from cbir WHERE imageId = ".mysql_real_escape_string($_GET['imageId']); $result = mysql_query($query) or die('Error, query failed'); while($row = mysql_fetch_array($result)){ header("content-type: image/jpeg"); echo $row['image']; }
You'd then need to do the following in your display script.
$query = "SELECT * from cbir"; $result = mysql_query($query) or die('Error, query failed'); while($row = mysql_fetch_array($result)){ if (abs($red_count - $row['red_count'])> 50 && abs($blue_count - $row['blue_count'])> 50 && abs($green_count - $row['green_count'])> 50 ){ echo '<img src="image.php?imageId='.$row['imageId'].'" />'; } }
Can I also just point out that you shouldn't really be using the mysql function any more, you should be using mysqli at the very least, but preferably PDO.