Home >Web Front-end >JS Tutorial >Analysis of the differences between php image generation functions_Basic knowledge
Newbies are confused about the PHP image generation functions imagecreatetruecolor() and imagecreate(). First, let’s take a look at the official explanation of these two functions:
resource imagecreatetruecolor ( int $x_size , int $y_size )
Returns an image identifier representing a black image of size x_size and y_size.
resource imagecreate (int $x_size, int $y_size)
Returns an image identifier, representing an image of size
There are some differences between the two when changing the background color:
imagecreatetruecolor needs to use imagefill() to fill the color
imagecreate() needs to use imagecolorAllocate() to add the background color
The php case is as follows: