Board index   FAQ   Search  
Register  Login
Board index php forum :: php coding PHP coding => Images

image creation giving errors why?

images php coding issues or problems here.

Moderators: macek, egami, gesf

image creation giving errors why?

Postby snsanju » Sun Nov 20, 2005 11:56 pm

Hi,
i am implementing the image verification code like in all forms, but when execute this code then it is giving some errors if i include some html tags, other wise it executes.
the error i am facing is

The image "http://test.mysite.com/contact_image.php" cannot be displayed, because it contains errors.

and code is
Code: Select all
<?php
header ("Content-type: image/png");
$im = @imagecreatetruecolor(150, 25)
      or die("Cannot Initialize new GD image stream");
$text_color = imagecolorallocate($im, 233, 14, 91);
imagestring($im, 1, 5, 5,  "A Simple Image", $text_color);
imagepng($im,"im.png");
imagedestroy($im);
?>
<html>
<head>
<title>image creation</title>
</head>
<body>
<img src="im.png">
</body>
</html>


can any body tell me why it is happenning?
regards
sanjeev
snsanju
New php-forum User
New php-forum User
 
Posts: 42
Joined: Thu Aug 04, 2005 1:35 am
Location: Bangalore, India

Postby Shiv » Mon Nov 21, 2005 2:19 am

I tested your code on my machine (windows/IIS). It works fine.
User avatar
Shiv
php-forum Active User
php-forum Active User
 
Posts: 262
Joined: Wed Feb 02, 2005 8:06 pm
Location: Ahmedabad (Gujarat), INDIA

Postby snsanju » Mon Nov 21, 2005 2:26 am

yes now its working, what i have done is just i commented the line
Code: Select all
//header("content-type: image/png");

so now i am getting the image.
snsanju
New php-forum User
New php-forum User
 
Posts: 42
Joined: Thu Aug 04, 2005 1:35 am
Location: Bangalore, India


Return to PHP coding => Images

Who is online

Users browsing this forum: Bing [Bot] and 1 guest

Sponsored by Sitebuilder Web hosting and Traduzioni Italiano Rumeno and antispam for cPanel.