Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> [PHP] Tworzenie obrazu za pomocą GD, Błąd nagłówka - headers already sent
tmgryf
post
Post #1





Grupa: Zarejestrowani
Postów: 79
Pomógł: 1
Dołączył: 14.02.2009

Ostrzeżenie: (0%)
-----


CODE
header('Content-type: image/jpeg');
// The file you are resizing
$file = './images/logo.jpg';

//This will set our output to 45% of the original size
$size = 0.45;

// This sets it to a .jpg, but you can change this to png or gif


// Setting the resize parameters
list($width, $height) = getimagesize($file);
$modwidth = $width * $size;
$modheight = $height * $size;

// Creating the Canvas
$tn= imagecreatetruecolor($modwidth, $modheight);
$source = imagecreatefromjpeg($file);

// Resizing our image to fit the canvas
imagecopyresized($tn, $source, 0, 0, 0, 0, $modwidth, $modheight, $width, $height);

// Outputs a jpg image, you could change this to gif or png if needed
imagejpeg($tn);
?>


Wywala błąd:
Warning: Cannot modify header information - headers already sent by (output started at /home/tmg/domains/pmg.izfree.com/public_html/image.php:1) in /home/tmg/domains/pmg.izfree.com/public_html/image.php on line 2

Przecież nagłówek wysyłam w pierwszej linii kodu - plik wywołuje bezpośrednio - serwer/image.php więc co jest nie tak?
Firebug twierdzi że dostaje: Content-Type text/html

Sam sobie odpowiem..... zmiana kodowania z utf8 na utf8 without bom rozwiazala problem (IMG:http://forum.php.pl/style_emoticons/default/blinksmiley.gif) (IMG:http://forum.php.pl/style_emoticons/default/party.gif)
Go to the top of the page
+Quote Post

Posty w temacie


Reply to this topicStart new topic
2 Użytkowników czyta ten temat (2 Gości i 0 Anonimowych użytkowników)
0 Zarejestrowanych:

 



RSS Aktualny czas: 3.10.2025 - 16:46