_flip_image_resource

Definition:
function _flip_image_resource($img, $horz, $vert) {}

Parameters

  • $img
  • $horz
  • $vert

Source code

function _flip_image_resource($img, $horz, $vert) {

	$w = imagesx($img);

	$h = imagesy($img);

	$dst = wp_imagecreatetruecolor($w, $h);

	if ( is_resource($dst) ) {

		$sx = $vert ? ($w - 1) : 0;

		$sy = $horz ? ($h - 1) : 0;

		$sw = $vert ? -$w : $w;

		$sh = $horz ? -$h : $h;



		if ( imagecopyresampled($dst, $img, 0, 0, $sx, $sy, $w, $h, $sw, $sh) ) {

			imagedestroy($img);

			$img = $dst;

		}

	}

	return $img;

}

4321

Advertisements

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

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: