hi friends, i got another problem with displaying image from the following source code
<?php
include "connection.php";
$id=$_GET['d'];// value of 'd' is getting from the another page
$image_folder='http://localhost/OldLiveHelp/images/'; //absolute path to image folder
$msql="SELECT * from client_logo where client_id='$id'";
$mresult= mysql_query($msql) or die(mysql_error());
$row=mysql_num_rows($mresult);
if($row > 0)
{
while ($row1 = mysql_fetch_array ($mresult))
{
$im=$row1['logo'];
}
$domain="http://localhost/OldLiveHelp/images/".$im;
// get the filename extension
$ext = substr($domain, -3); // here -3 reads 3 characters from last position of the string in reverse order.
// set the MIME type
switch ($ext)
{
case 'jpg':
$mime = 'image/jpeg';
break;
case 'gif':
$mime = 'image/gif';
break;
case 'png':
$mime = 'image/png';
break;
default:
$mime = false;
}
// if a valid MIME type exists, display the image
// by sending appropriate headers and streaming the file
if ($mime)
{
header('Content-type: '.$mime);
header('Content-length: '.filesize($domain));
$file = @fopen($domain, 'rb');
if ($file)
{
fpassthru($file);
exit;
}
}
}
?>
if i pass full image path with the name of image i.e (http://localhost/LiveHelp/images/helplogo.jpg) instead of retrieving image name from database it returns the image. the above code return the full path of image instead of image
if any of u have a better solution then suggest me.
thx in advance.