hi
i have stored user profile images in an BLOB field.,
and need to display it as an thumbnail image in their profile page.,
and i searched through the net and got the result using header functions as
follows.,
which results in displaying a perfect thumb image..
but when i try to display the image after some other execution of php code., i,e
for example if i insert an tag
before displaying the image.,
i get an error message
"Warning: Cannot modify header information - headers already sent by (output started at D:\xampp\htdocs ...........(the line where the echo statement comes"
how to get over this...
any ideas..
regards
vijay
i have stored user profile images in an BLOB field.,
and need to display it as an thumbnail image in their profile page.,
and i searched through the net and got the result using header functions as
follows.,
Code:
<?
include 'config.php';
function displayimage($data)
{
$type='image/pjpeg';
Header( "Content-type: $type");
$size = 150; // new image width
$src = imagecreatefromstring($data);
$width = imagesx($src);
$height = imagesy($src);
$aspect_ratio = $height/$width;
if ($width <= $size) {
$new_w = $width;
$new_h = $height;
} else {
$new_w = $size;
$new_h = abs($new_w * $aspect_ratio);
}
$img = imagecreatetruecolor($new_w,$new_h);
imagecopyresized($img,$src,0,0,0,0,$new_w,$new_h,$width,$height);
imagejpeg($img);
imagedestroy($img);
}
//displaying image from database
$query = "select content from photo where pid = 1";
$result = @mysql_query($query);
$data = @mysql_result($result,0,"content");
displayimage($data);
?>
but when i try to display the image after some other execution of php code., i,e
for example if i insert an tag
Code:
<? echo "image here";?>
i get an error message
"Warning: Cannot modify header information - headers already sent by (output started at D:\xampp\htdocs ...........(the line where the echo statement comes"
how to get over this...
any ideas..
regards
vijay
Comment