Programming Articles - Page 2865 of 3368

imagecreate() function in PHP

Chandu yadav
Updated on 31-Dec-2019 06:25:14

7K+ Views

The imagecreate() function is used to create a new image. It is preferred to use imagecreatetruecolor() to create an image instead of imagecreate(). This is because the image processing occurs on the highest quality image possible which can be created using imagecreatetruecolor().Syntaximagecreate( $width, $height )Parameterswidth: The width of imageheight: The height of imageReturnThe imagecreate() function returns an image resource identifier on success or FALSE on errors.ExampleThe following is an example:OutputThe following is the output:

imagesx() function in PHP

Ankith Reddy
Updated on 31-Dec-2019 06:24:40

290 Views

The imagesx() function gets the width of image. It returns the width of the image or FALSE on errors.Syntaximagesx(img)Parametersimg: Image resource created with imagecreatetruecolor()ReturnThe imagesx() function returns the width of the image or FALSE on errors.ExampleThe following is an example: Live DemoOutputThe following is the output:450

imagesy() function in PHP

George John
Updated on 31-Dec-2019 06:24:03

116 Views

The imagesy() function gets the height of image. It returns the height of the image or FALSE on errors.Syntaximagesy(img)Parametersimg: Image resource created with imagecreatetruecolor()ReturnThe imagesy() function returns the height of the image or FALSE on errors.ExampleThe following is an example: Live DemoOutputThe following is the output:250

imagecolorat() function in PHP

Arjun Thakur
Updated on 31-Dec-2019 06:23:18

342 Views

The imagecolorat() function gets the index of the color of the pixel.Syntaximagecolorat( $img, $x, $y )Parametersimg: Create an image with imagecreatetruecolor() function.x: The x-coordinate of the point.y: The y-coordinate of the point.ReturnThe imagecolorat() function returns the color index or FALSE on failure.ExampleThe following is an example: Live DemoOutputThe following is the output:array(4) { ["red"]=> int(255) ["green"]=> int(255) ["blue"]=> int(255) ["alpha"]=> int(127) }

getimagesize() function in PHP

Chandu yadav
Updated on 31-Dec-2019 06:22:42

3K+ Views

The getimagesize() function is used to display the size of an image.Syntaxgetimagesize(file_name, img_info)Parametersfile_name: The file image i.e. the image path.img_info: Extract some extended information from the image file. Supports only JFIF files.ReturnThe getimagesize() function returns an array element with height, width, type, MIME type of the image, etc.ExampleThe following is an example: Live DemoOutputThe following is the output:Array ( [0] => 205 [1] => 120 [2] => 3 [3] => width="205" height="120" [bits] => 8 [mime] => image/png)

imagefill() function in PHP

Ankith Reddy
Updated on 31-Dec-2019 06:21:35

396 Views

The imagefill() function is used to fill the image.Syntaximagefill(img, x, y, color)ParametersimgCreate a blank image with imagecreatetruecolor().x x-coordinate of start pointy y-coordinate of start pointcolor The fill color.ReturnThe imagefill() function returns TRUE on success or FALSE on failure.ExampleThe following is an example:OutputThe following is the output:

imagedashedline() function in PHP

George John
Updated on 31-Dec-2019 06:20:51

92 Views

The imagedashedline() function draws a dashed line.Syntaximagedashedline( $image , $x1 , $y1 , $x2 , $y2 , $color )Parametersimage Create a blank image with imagecreatetruecolor().x1 Upper left x-coordinatey1 Upper left y-coordinatex2 Bottom right x-coordinatey2 Bottom right y-coordinatecolor The fill color.ReturnThe function returns TRUE on success or FALSE on failure.ExampleThe following is an example:OutputThe following is the output:

imagefilledrectangle() function in PHP

Arjun Thakur
Updated on 31-Dec-2019 06:20:11

1K+ Views

The imagefilledrectangle() function draws a filled rectangle.Syntaximagefilledrectangle( $img, $x1, $y1, $x2, $y2, $color )Parametersimage Create a blank image with imagecreatetruecolor().x1x-coordinate for point 1.y1 y-coordinate for point 1.x2 x-coordinate for point 2.y2 y-coordinate for point 2.color The fill color.ReturnThe imagefilledrectangle() function returns TRUE on success or FALSE on failure.ExampleThe following is an example:OutputThe following is the output:

imagefilledellipse() function in PHP

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

166 Views

The imagefilledellipse() function is used to draw a filled ellipse.Syntaximagefilledellipse( $img, $cx, $cy, $width, $height, $color )Parametersimg This creates a blank image with imagecreatetruecolor()cx x-coordinate of the center.cy y-coordinate of the center.width The ellipse width.height The ellipse height.color The fill color.ReturnThe imagefilledellipse() function returns TRUE on success or FALSE on failure.ExampleThe following is an example:OutputThe following is the output:

gmp_or() function in PHP

Ankith Reddy
Updated on 30-Dec-2019 10:53:17

76 Views

The gmp_or() function computes the bitwise OR of two GMP numbers.Syntaxgmp_or(n1, n2)Parametersn1: The first GMP number. It can be GMP object in PHP version 5.6 and later. Can also be numeric strings.n2: The second GMP number. It can be GMP object in PHP version 5.6 and later. Can also be numeric strings.ReturnThe gmp_or() function returns the OR of the GMP numbers. The result is also a GMP number.ExampleThe following is an example:OutputThe following is the output:7

Advertisements