Programming Articles - Page 2863 of 3368

imagecolorclosest() function in PHP

George John
Updated on 31-Dec-2019 07:23:04

103 Views

The imagecolorclosest() function gets the index of the closest color to the specified color.Syntaximagecolorallocatealpha (img, red, green, blue)Parametersimg: Image resource created with imagecreatetruecolor().red: Red color componentgreen: Green color componentblue: Blue color componentReturnThe imagecolorclosest() function returns the index of the closest color, in the palette of the image.ExampleThe following is an example: Live Demo

imagecolorallocatealpha() function in PHP

Ankith Reddy
Updated on 31-Dec-2019 07:22:02

256 Views

The imagecolorallocatealpha() function allocates a color for an image.Syntaximagecolorallocatealpha ( img, red, green, blue, alpha )Parametersimg: Image resource created with imagecreatetruecolor().red: Red color componentgreen: Green color componentblue: Blue color componentalpha: The transparency of image, with 0 indicating completely opaque, whereas 127 indicating completely transparent.ReturnThe imagecolorallocatealpha() function returns a color identifier or FALSE if the allocation failed.ExampleThe following is an example:OutputThe following is the output:

imagecolorallocate() function in PHP

Chandu yadav
Updated on 31-Dec-2019 07:21:19

597 Views

The imagecolorallocate() function allocates a color for an image.Syntaxint imagecolorallocate ( $img, $red, $green, $blue )Parametersimg: Image resource created with imagecreatetruecolor().red: Red color componentgreen: Green color componentblue: Blue color componentReturnThe imagecolorallocate() function returns a color in RGB format.ExampleThe following is an example:OutputThe following is the output:

imagecolorexact() function in PHP

Arjun Thakur
Updated on 31-Dec-2019 07:20:41

88 Views

The imagecolorexact() function gets the index of the specified color.Syntaximagecolorexact ( $img, $red, $green, $blue )Parametersimg: Image resource created with imagecreatetruecolor().red: Red color componentgreen: Green color componentblue: Blue color componentReturnThe imagecolorexact() function returns the index of the specified color in the palette, or -1 if the color does not exist.ExampleThe following is an example: Live DemoOutputThe following is the output:Array ( [0] => 1989170 [1] => 5273700 [2] => 1658930 )

imagecolorclosesthwb() function in PHP

George John
Updated on 31-Dec-2019 07:20:04

60 Views

The imagecolorclosesthwb() function gets the index of the color which has the hue, white and blacknessSyntaximagecolorclosesthwb ( $img, $red, $green, $blue )Parametersimg: Create image with imagecreatetruecolor()red: Red color componentgreen: Green color componentblue: Blue color componentReturnThe imagecolorclosesthwb() function returns an integer with the index of the color which has the hue, white and blackness nearest the given color.ExampleThe following is an example: Live DemoOutputThe following is the output:HWB = 87

imagecolorclosestalpha() function in PHP

Ankith Reddy
Updated on 31-Dec-2019 07:19:16

75 Views

The imagecolorclosestalpha() function gets the index of closet color with alpha value.Syntaximagecolorclosestalpha ( img, red, green, blue, alpha )Parametersimg: Image resource created with imagecreatetruecolor().red: Red color componentgreen: Green color componentblue: Blue color componentalpha: The transparency of image, with 0 indicating completely opaque, whereas 127 indicating completely transparent.ReturnThe imagecolorclosestalpha() function returns the index of the closest color in the palette.ExampleThe following is an example: Live Demo

imageflip() function in PHP

George John
Updated on 31-Dec-2019 07:18:28

319 Views

The imageflip() function is used to flip an image using given mode.Syntaxbool imageflip(img, mode )Parametersimg: An image resource created using imagecreatetruecolor()mode: The flip mode. Here are the possible values:IMG_FLIP_HORIZONTAL – Flips the image horizontally.IMG_FLIP_VERTICAL – Flips the image vertically.IMG_FLIP_BOTH – Flips the image both horizontally and vertically.ReturnThe imageflip() function returns TRUE on success or FALSE on failure.ExampleThe following is an example that flips an image horizontally:OutputThe following is the output:

imagepolygon() function in PHP

Arjun Thakur
Updated on 31-Dec-2019 07:17:56

388 Views

The imagepolygon() function is used to draw a polygon.Syntaxbool imagepolygon( $img, $points, $num_points, $color)Parameters$img: Create a blank image with imagecreatetruecolor() function.$points: An array with vertices of polygon.$num_points: Total number of vertices in a polygon.$color: A color identifier created with imagecolorallocate() function.ReturnThe imagepolygon() function returns TRUE on success or FALSE on failure.ExampleThe following is an example:OutputThe following is the output:

gmp_rootrem() function in PHP

karthikeya Boyini
Updated on 31-Dec-2019 07:01:47

88 Views

The gmp_rootrem() function is used to calculate the nth root of a GMP number. It returns the integer component of the nth root and remainder.Syntaxgmp_rootrem($n,$root)Parametersn − It can be GMP object in PHP version 5.6 and later. Can also be numeric strings.root − The root of the number nReturnThe gmp_rootrem()function returns the integer component of the nth root and remainder.ExampleThe following is an example −OutputThe following is the output −Array (    [0] => GMP Object ( [num] => 3 )    [1] => GMP Object ( [num] =>6 ) )

IntlChar getCombiningClass() function in PHP

Samual Sam
Updated on 31-Dec-2019 06:59:42

57 Views

The IntlChar getCombiningClass() function is used to get the combining class of the value val.Syntaxint IntlChar::getCombiningClass (val)Parametersval − An integer or character encoded as a UTF-8 string.ReturnThe IntlChar getCombiningClass() function returns the combining class of the value val.ExampleThe following is an example −OutputThe following is the output −int(0) NULL

Advertisements