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 = ImageCreateFrom Jpeg($file_jpg) ;
$size = GetImageSize($i mage);
$src_w = $size[0];
$src_h = $size[1];
$dst_w = floor($src_w / 3);
$dst_h = floor($src_h / 3);
$dst_im = ImageCreateTrue Color($dst_w,$d st_h);
ImageCopyResamp led($dst_im,$sr c_im,0,0,0,0,$d st_w,$dst_h,$sr c_w,$src_h);
ImageJpeg($dst_ im);
ImageDestroy($d st_im);
imageDestroy($s rc_im);
}
and use it like that : '<img src="'.Get_Redi m_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
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 = ImageCreateFrom Jpeg($file_jpg) ;
$size = GetImageSize($i mage);
$src_w = $size[0];
$src_h = $size[1];
$dst_w = floor($src_w / 3);
$dst_h = floor($src_h / 3);
$dst_im = ImageCreateTrue Color($dst_w,$d st_h);
ImageCopyResamp led($dst_im,$sr c_im,0,0,0,0,$d st_w,$dst_h,$sr c_w,$src_h);
ImageJpeg($dst_ im);
ImageDestroy($d st_im);
imageDestroy($s rc_im);
}
and use it like that : '<img src="'.Get_Redi m_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
Comment