|
Posted by PaowZ on 10/02/05 14:01
Hi there!
I'm trying to setup a function which could resize some jpgs 'on the
fly', I want them to be displayed into the browser.
Here is my function:
function Get_Redim_Jpg($file_jpg){
Header("Content-type: image/jpeg");
$src_im = ImageCreateFromJpeg($file_jpg);
$size = GetImageSize($image);
$src_w = $size[0];
$src_h = $size[1];
$dst_w = floor($src_w / 3);
$dst_h = floor($src_h / 3);
$dst_im = ImageCreateTrueColor($dst_w,$dst_h);
ImageCopyResampled($dst_im,$src_im,0,0,0,0,$dst_w,$dst_h,$src_w,$src_h);
ImageJpeg($dst_im);
ImageDestroy($dst_im);
imageDestroy($src_im);
}
and use it like that : '<img src="'.Get_Redim_Jpg("my_jpg").'">
So I must use header function to get it displayed as a jpg.
but I get the 'headers already sent' error..
I don't really see where I have to user header function to avoid
errors...
any idea ?
thanks a lot.
PaowZ
[Back to original message]
|