There is NO REASON to store absolute path and many reasons NOT to do so.
One good reason: If you store only relative path, then at a future time you could move the entire images directory to some other location and yet the RELATIVE paths would still be correct!
Also, if you store paths and not BLOBs then you do *NOT* need or want the silly "getImageFromDatabase.php" page!!
Let's say you had a PRODUCTS table that looked like this:
Now I don't use PHP, so this code will be both old and possibly have errors, but it will give you the idea:
prodid -- prodname -- imagename
17 -- 4 Slice Toaster -- toaster4.gif
32 -- 5 Speed Blender -- blender5.jpg
41 -- 2 Burner Hotplate -- hotplate2.png
$sql = "SELECT * FROM products ORDER BY prodid";
$result = mysql_query( $sql ) or die( mysql_error() );
$imageBase = "/productImages/"; // all images assumed to be in this directory
while( $row = mysql_fetch_assoc( $result )
<a href="showProduct.php?id=<?php echo $row["prodid"];?>">
<?php echo $row["prodname"]; ?>
<img src="<?php echo $imageBase . $row["imagename"];?>" width="200"/>