The imagecrop() function is an inbuilt function in PHP which is used to crop an image to the given rectangle. This function crops an image to the given rectangular area and returns the resulting image. The given image is not modified.
resource imagecrop ( $image, $rect )
Parameters: This function accepts two parameters as mentioned above and described below:
- $image: It is returned by one of the image creation functions, such as imagecreatetruecolor(). It is used to create size of image.
- $rect: The cropping rectangle as array with keys x, y, width and height.
Return Value: This function return cropped image resource on success or False on failure.
Below programs illustrate the imagecrop() function in PHP:
- How to get the function name inside a function in PHP ?
- PHP | Ds\Map last() Function
- PHP | next() Function
- PHP | abs() Function
- CSS | url() Function
- D3.js | d3.sum() function
- D3.js | d3.mean() function
- p5.js | arc() Function
- p5.js | nfs() Function
- p5.js | nfp() Function
- p5.js | pow() function
- p5.js | hue() function
- D3.js | d3.map.set() Function
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to firstname.lastname@example.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.