we should use imagecreatefromtruecolor() rather than image create, though i am not sure if there any update function at http://php.net/manual/, but it seems i am right, ok for avoiding confusion learner may do googling for the correct one, i am on a slow connection so it is boring to checkout. but as far as i know when i was studied php.net/manual, there was the recommendation to use imagecreatefromtruecolor(). hope it helps someone
imagecreatetruecolor() returns an image identifier representing a black image of the specified size.
Depending on your PHP and GD versions this function is defined or not. With PHP 4.0.6 through 4.1.x this function always exists if the GD module is loaded, but calling it without GD2 being installed PHP will issue a fatal error and exit. With PHP 4.2.x this behaviour is different in issuing a warning instead of an error. Other versions only define this function, if the correct GD version is installed.
<?php
header ('Content-Type: image/png');
$im = @imagecreatetruecolor(120, 20)
or die('Cannot Initialize new GD image stream');
$text_color = imagecolorallocate($im, 233, 14, 91);
imagestring($im, 1, 5, 5, 'A Simple Text String', $text_color);
imagepng($im);
imagedestroy($im);
?>
sorry there for being late in response, it is the later era of php 5.3, so it is value less if you want to use the php4.1.x, because server technology is always upgrading, could you please think $HTTP_GET_VARS rather than $_GET, then my comment is this is totally a foolishness or bad practice those should be thrown in hell..
I am thankful to you, cz it was not imagecreatefromtruecolor() as i commented first time but it will be imagecreatetruecolor() as you mentioned.
and obviously sorry for my mistake!
Don't mention it. We are all making that mistake if we don't keep touch with current technology in the relevant field. Few months ago i too made this like mistake using JQuery live() event instead of on() in VCampus. One of our VCampus member request me to see about on() event. Then I discovered live() have been absolute in current version.
Comments 6