imagegetclip() is an inbuilt PHP function that is used to get the clipping rectangle. It is used to retrieve the current clipping rectangle, the area beyond which no pixels will be drawn.
Syntax
array imagegetclip(resource $image)
Parameters
imagegetclip() takes only one parameter, $image. It holds the image resource returned by one of the image creation functions such as imagecreatetruecolor().
Return Types
imagegetclip() returns an indexed array with the coordinates of the clipping rectangle x, y upper left corner, and x, y lower-left corner.
Example 1
<?php $img = imagecreate(200, 200); //set the image clip. imagesetclip($img, 20,20, 90,90); print_r(imagegetclip($img)); ?>
Output
Array ( [0] => 20 [1] => 20 [2] => 90 [3] => 90 )
Example 2
<?php // load an image from the local drive folder $img = imagecreatefrompng('C:\xampp\htdocs\Images\img34.png'); print("<pre>".print_r(imagegetclip($img),true)."<pre>"); ?>
Output
Array ( [0] => 0 [1] => 0 [2] => 611 [3] => 395 )