Posted by:
smiley76
(---.160.172.2.static.vsnl.net.in)
I have now enabled gd2 as u said..and i am also able to see gd2 enabled instruction if i am using phpinfo() function..
also when i used
var_dump(gd_info());
the above function i am getting the result mentioned below on the browser
array(12) { ["GD Version"]=> string(27) "bundled (2.0.28 compatible)" ["FreeType Support"]=> bool(true) ["FreeType Linkage"]=> string(13) "with freetype" ["T1Lib Support"]=> bool(true) ["GIF Read Support"]=> bool(true) ["GIF Create Support"]=> bool(true) ["JPG Support"]=> bool(true) ["PNG Support"]=> bool(true) ["WBMP Support"]=> bool(true) ["XPM Support"]=> bool(false) ["XBM Support"]=> bool(true) ["JIS-mapped Japanese Font Support"]=> bool(false) }
which i reckon means that gd2 is now enabled perfectly...
but when I am trying to execute my code i am still getting the same error msg. I have pasted my code and also the error msg below:
Code:
<?php
header ("Content-type: image/png"
;
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "[
www.w3.org];
<html xmlns="[
www.w3.org];
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>GD Configuration Test</title>
</head>
<body>
<?php
$im = @ImageCreate ( 50, 100)
or die ("Cannot create a new GD image."
;
$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);
?>
</body>
</html>
Error Msg:
The image [
localhost] cannot be displayed, because it contains errors.
I reckon we are getting this msg because of the headerheader ("Content-type: image/png"
; that we have written in the beginning of the file. Tried placing the header statement at different places but still getting the same error.
Can you pls find a solution for this error now.