PHP Image createtruecolor( ) FunctionImage createtruecolor( ) function is another inbuilt PHP function mainly used to create a new true-color image. The function returns the given image in a specific size. We need to define the width and height of the required image. Instead of the image createtruecolor( ) function, we can also use other creative functions like image create ( ), which is another alternative as it will return a different image quality. Syntax
The imagecreatetruecolor( ) function returns the resource identifier of an image on successful execution of the program and FALSE on a failed attempt. Program 1: PHP program to display the basic use of imagecreatetruecolor ( ) function Output Here in this program, we have declared various variables like $image to define the size of the image that we require, $background color to define the color of background we require, $text color to define the color of text we require. We have used the image string ( ) function to declare the string we want to display as an image. To display the output of the image, we have used an inbuilt PHP command header and imagepng to display on the browser. Program 2: PHP program to display the use of imagecreatetruecolor ( ) function Output Here in this program, we have declared various variables like $image to define the size of the image that we require, $background color to define the color of background we require, $text color to define the color of text we require. We have used the image string ( ) function to declare the string we want to display as an image. To display the output of the image, we have used an inbuilt PHP command header and imagepng to display on the browser. Program 3: PHP program to display the use of imagecreatetruecolor ( ) function to draw a polygon Output Here in this program, we have declared various variables like $image to define the size of the image that we require, $background color to define the color of background we require, $text color to define the color of text we require, an array $valuesto set the coordinates of the polygon we need to declare, and we have used image polygon ( ) function to display the polygon we want to display as an image, to display the output of the image we have used an inbuilt PHP command header and imagepng to display on browser. Program 4: PHP program to display the use of imagecreatetruecolor ( ) function to draw a polygon Output Here in this program, we have declared various variables like $image to define the size of the image that we require, $background color to define the color of background we require, $text color to define the color of text we require, an array $values to set the coordinates of the polygon we need to declare, and we have used image polygon ( ) function to display the polygon we want to display as an image, to display the output of the image we have used an inbuilt PHP command header and imagepng to display on browser. Next TopicPHP Imagestring() Function |