For Programmers: Free Programming Magazines  


Home > Archive > PHP Language > March 2006 > imagegammacorrect









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author imagegammacorrect
Jean Pierre Daviau

2006-03-22, 6:58 pm

I copy pasted this code from a book I just bought from Atkinson.

The image is in the same folder has the page. The page displays the string.
What am I doing wrong ... again?

<?php
echo "In ima page\n";



//attempt to open image, suppress error messages
if(!($image = @imagecreatefromjpeg("deuxpointdeux.jpg")))
{
//error, so create an error image and exit
$image = imagecreate(200,200);
$colorWhite = imagecolorallocate($image, 255, 255, 255);
$colorBlack = imagecolorallocate($image, 0, 0, 0);
imagefill($image, 0, 0, $colorWhite);
imagestring($image, 4, 10, 10, "Couldn't load image!",
$colorBlack);
header("Content-type: image/jpeg");
imagejpeg($image);
exit();
}

//adjust gamma, display inputimage, outputimage
imagegammacorrect($image, 2.2, 1.571);

//send image
header("Content-type: image/jpeg");

imagejpeg($image);

?>

--
Thanks for your attention.

Jean Pierre Daviau
--
Easyphp1.8
Apache1.3.24
DEVC++, borland 5.5
windows Xp
asus p4 s533/333/133
Intel(R) Celeron (R) CPU 2.00 GHz
http://www.jeanpierredaviau.com


Oli Filth

2006-03-22, 6:58 pm

Jean Pierre Daviau said the following on 22/03/2006 15:01:
> I copy pasted this code from a book I just bought from Atkinson.
>
> The image is in the same folder has the page. The page displays the string.
> What am I doing wrong ... again?
>

<...SNIP CODE...>

Read the PHP manual page for header() again, carefully...

--
Oli
Jean Pierre Daviau

2006-03-22, 6:58 pm

I tried this

if (!extension_loaded('gd')) {
if (!dl('gd.so')) {
print '<P>gd.so:False<BR>';
}
}else
print '<P>gd.so:True<BR>';

Answer: true.

and a bunch of text
-------------------------------------------
trueJFIF>CREATOR: gd-jpeg v1.0 (using IJG JPEG v62), default
quality C    $.' ",#(7),01444'9=82<.342C 
2!!22222222222222222222222222222222222
222222222222222I"
ĵ}!1AQa"q2'#BR$3br, %
----------------------------------------------


Jean Pierre Daviau

2006-03-23, 6:58 pm

I tried this without success:

<html>
<head>
<title> New Document </title>
</head>
<body>
<IMG SRC="makeImg.php" >
</body>
</html>


Jean Pierre Daviau

2006-03-25, 7:57 am

header sending problem


Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com