_crop_image_resource

Definition:
function _crop_image_resource($img, $x, $y, $w, $h) {}

Parameters

  • $img
  • $x
  • $y
  • $w
  • $h

Source code

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;

}

4303

No comments yet... Be the first to leave a reply!

Leave a comment