You are here: jpg header trouble « PHP Programming Language « IT news, forums, messages
jpg header trouble

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

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация