
- You are not logged in. | Login
January 18, 2007 10:03 am
- purplebean
- Member


Images created by PHP are not printed
Why doesn't the following code work?
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1251" />
<title>XxX</title>
</head>
<?php
header("Content-type: image/png");
$im = @imagecreate(100, 50)
or die("Cannot Initialize new GD image stream");
$background_color = imagecolorallocate($im, 255, 255, 255);
$text_color = imagecolorallocate($im, 233, 14, 91);
imagestring($im, 1, 5, 5, "A Simple Text String", $text_color);
imagepng($im);
imagedestroy($im);
?>
<body>
</body>
</html>There are no errors, browser is emtpy.
What is the problem?
January 18, 2007 10:05 am
- PHPprof
- Member


Re: Images created by PHP are not printed
Really?
What do you want to see on tha page as a result?
I'll come to win... wait...
January 18, 2007 10:06 am
- purplebean
- Member


Re: Images created by PHP are not printed
There should appear image with "A Simple Text String" inscription
January 18, 2007 10:10 am
- PHPprof
- Member


Re: Images created by PHP are not printed
Actually I can't see here the tag <img..>
I'll come to win... wait...
January 18, 2007 10:17 am
- purplebean
- Member


Re: Images created by PHP are not printed
I tried all variants, but I can do nothing.
Here is an example:
<?php
ini_set('display_errors',1);
error_reporting(E_ALL);
$image = imagecreatetruecolor(80,60) // Create the image...
or die('Cannot create image'); // ...stop script's working in the case of the error
imagefill($image, 0, 0, 0x000080);
imageellipse($image, 40, 30, 50, 50, 0xFFFF00);
imagefilledellipse($image, 30, 20, 10, 10, 0xFFFF00);
imagefilledellipse($image, 50, 20, 10, 10, 0xFFFF00);
imageline($image, 40, 28, 40, 38, 0xFFFF00);
imagearc($image, 40, 30, 40, 40, 45, 135, 0xFFFF00);
imagedestroy($image); // release memory given for the image
?>In the locahost there are problems with Call to undefined function imagecreatetruecolor() function
But everything works on the host
?????
January 18, 2007 10:19 am
- purplebean
- Member


Re: Images created by PHP are not printed
Do you think that problem is in the php.ini file?
January 18, 2007 10:20 am
- mmwfan
- Member


Re: Images created by PHP are not printed
Your example works if you delete some unnesesary items
January 18, 2007 10:29 am
- purplebean
- Member


Re: Images created by PHP are not printed
We made it!!!!
The only thing I had to do is to uncomment extension=php_gd2.dll to the php.ini and put to the sytem32



