Found 1046 Articles for PHP

imagecharup() function in PHP

Ankith Reddy
Updated on 31-Dec-2019 07:40:15

25 Views

The imagecharup() function is used to draw a character vertically.Syntaximagecharup( img, font, x, y, c, color )Parametersimg: Create an image with imagecreatetruecolor()font: Sets the font size. It can be 1, 2, 3, 4, 5 for built-in fonts in latin2 encodingx: x-coordinatey: y-coordinatec: character to be drawncolor: color identifierReturnThe imagecharup() function returns TRUE on success or FALSE on failure.ExampleThe following is an example:OutputThe following is the output:ExampleLet us see another example:OutputThe following is the output that draws character E with different dimensions:

imagechar() function in PHP

Chandu yadav
Updated on 31-Dec-2019 07:38:45

74 Views

The imagechar() function draws a character horizontally.Syntaxbool imagechar( img, font, x, y, ch, color )Parametersimg: Creating an image with imagecreatetruecolor().font: Set font sizex: x-coordinatey: y-coordinatec: The character to draw.color: A color identifier created with imagecolorallocate().ReturnThe imagechar() function returns TRUE on success or FALSE on failure.ExampleThe following is an example:OutputThe following is the output:ExampleLet us see another example wherein we are drawing a character with different coordinates and height/ width as shown in the above example:OutputThe following is the output:

imagearc() function in PHP

Arjun Thakur
Updated on 31-Dec-2019 07:24:38

244 Views

The imagearc() function is used to draw an arc.Syntaximagearc( $img, $cx, $cy, $width, $height, $start, $end, $color )Parameters$img: Creates an image with imagecreatetruecolor().$cx: x-coordinate of the center.$cy: y-coordinate of the center.$width: The width of arc.$height: The height of arc.$start: The arc start angle, in degrees.$end: The arc end angle in degrees.$color: It sets the color of image.ReturnThe imagearc() function returns the TRUE on success or FALSE on failure.ExampleThe following is an example:OutputThe following is the output:ExampleLet us see another example wherein we have different coordinates and angle for arc:OutputThe following is the output:Read More

imagecolorclosest() function in PHP

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

39 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

197 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

462 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

48 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

24 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

38 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

221 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:

Advertisements