WordPress at a glance
function is not described

_crop_image_resource() WP 2.9.0

Crops an image resource. Internal use only.

No Hooks.

Return

resource. (maybe) cropped image resource.

Usage

_crop_image_resource( $img, $x, $y, $w, $h );
$img(resource) (required)
Image resource.
$x(float) (required)
Source point x-coordinate.
$y(float) (required)
Source point y-cooredinate.
$w(float) (required)
Source width.
$h(float) (required)
Source height.

Code of crop image resource: wp-admin/includes/image-edit.php WP 5.2.2

<?php
function _crop_image_resource( $img, $x, $y, $w, $h ) {
	$dst = wp_imagecreatetruecolor( $w, $h );
	if ( is_resource( $dst ) ) {
		if ( imagecopy( $dst, $img, 0, 0, $x, $y, $w, $h ) ) {
			imagedestroy( $img );
			$img = $dst;
		}
	}
	return $img;
}