Hi all,
Please look into my code TWo files..
1. <?php
include_once("../configure/config.php");
include_once("../lib_classes/class.DBaccess.php");
$me = new DBaccess();
$read_status = $me->readData("person", "person_id=".'21', "profile_photo, image_type");
if($read_status[0] == 1)
{
$image = $read_status[1][0]['profile_photo'];
$type = $read_status[1][0]['image_type'];
}
header("Content-type: ".$type);
echo $image;
?>
2. AND I am calling the file with an img tag..
<tr><td rowspan="7" align="left" valign="top"><img src= "show_profile_photo.php" width="114" height="104">
But here image is displaying after page is being refreshed. Not updating the image at first
time.
What I should I do to correct it..
Please help.
Regards
PHp file in IMG tag
Moderator: General Moderators
Re: PHp file in IMG tag
You need to send a cache control header eg
Your script has another problem though.. if $read_status[0] is not 1 then you'll get a broken image.
Code: Select all
header("Cache-Control: no-cache");Re: PHp file in IMG tag
Thank you for your help
I will correct it..
I will correct it..
Re: PHp file in IMG tag
Hi
Still its not working..
Still its not working..
Re: PHp file in IMG tag
What headers have you added?sanju wrote:Hi
Still its not working..
Re: PHp file in IMG tag
hi here is the file,..
session_start();
include_once("../configure/config.php");
include_once("../lib_classes/class.DBaccess.php");
$me = new DBaccess();
$read_status = $me->readData("person", "person_id=".$_SESSION['login_member_id'], "profile_photo, image_type");
if($read_status[0] == 1)
{
$image = $read_status[1][0]['profile_photo'];
$type = $read_status[1][0]['image_type'];
}
else
{
$image = file_get_contents($me->base_directory.'images/man.gif');
$type = 'image/gif';
}
header("Content-type: image/jpeg");
header("Cache-Control: no-cache");
imagejpeg($image);
REgards
session_start();
include_once("../configure/config.php");
include_once("../lib_classes/class.DBaccess.php");
$me = new DBaccess();
$read_status = $me->readData("person", "person_id=".$_SESSION['login_member_id'], "profile_photo, image_type");
if($read_status[0] == 1)
{
$image = $read_status[1][0]['profile_photo'];
$type = $read_status[1][0]['image_type'];
}
else
{
$image = file_get_contents($me->base_directory.'images/man.gif');
$type = 'image/gif';
}
header("Content-type: image/jpeg");
header("Cache-Control: no-cache");
imagejpeg($image);
REgards
Re: PHp file in IMG tag
What other cache control headers have you tried? Or did you just try what I suggested without bothering to read up on what the header does, and now you're back on here expecting people on the internet to do your job for you because you're too lazy to do any research?