HELP! IMAGES NOT OPENING IN PHP!
Posted: Thu Jul 10, 2008 9:13 am
Please avoid words like HELP! and don't use ALL UPPERCASE in your Subject. Readers of this forum will interpret that to mean that you think that your problem is more important than anyone else's, and many will deliberately not even read your post. Nobody has a priority over everyone else here. Just state your problem.
Also, learn to use the [ php ] and [ /php ] tags around your code, as I have done for you below, to make your code more readable. If you follow the rules here, you will probably get someone to help you.
HI!
I am using the following code for drawing a rectangle:
and I am getting the following weird output in the browser:
ÿØÿàJFIFÿþ>CREATOR: gd-jpeg v1.0 (using IJG JPEG v62), default quality ÿÛC $.' ",#(7),01444'9=82<.342ÿÛC 2!!22222222222222222222222222222222222222222222222222ÿÀ––.
I am using Apache 2.2.8, PHP 5.2.6 & in my php.ini file, there is the following line:
extension=php_gd2.dll.
But I don't know what is the problem. Anyone who knows how to correct it, please help.
Also, learn to use the [ php ] and [ /php ] tags around your code, as I have done for you below, to make your code more readable. If you follow the rules here, you will probably get someone to help you.
HI!
I am using the following code for drawing a rectangle:
Code: Select all
<html><body>
<?php
$myImage = @ImageCreate(150, 150);
$black = ImageColorAllocate($myImage, 0, 0, 0);
$white = ImageColorAllocate($myImage, 255, 255, 255);
$red = ImageColorAllocate($myImage, 255, 0, 0);
$gren = ImageColorAllocate($myImage, 0, 255, 0);
$blue = ImageColorAllocate($myImage, 0, 0, 255);
//draw some rectangles
ImageRectangle($myImage, 15, 15, 40, 55, $red);
ImageRectangle($myImage, 40, 55, 65, 95, $white);
//output the image to the browser
header ("Content-type: image/jpeg");
ImageJpeg($myImage);
//clean up after yourself
ImageDestroy($myImage);
?>
</body>
</html>
ÿØÿàJFIFÿþ>CREATOR: gd-jpeg v1.0 (using IJG JPEG v62), default quality ÿÛC $.' ",#(7),01444'9=82<.342ÿÛC 2!!22222222222222222222222222222222222222222222222222ÿÀ––.
I am using Apache 2.2.8, PHP 5.2.6 & in my php.ini file, there is the following line:
extension=php_gd2.dll.
But I don't know what is the problem. Anyone who knows how to correct it, please help.