WordPress at a glance
function is not described

_flip_image_resource() WP 2.9.0

Deprecated in 3.5.0. It is no longer supported and can be removed in future releases. Use WP_Image_Editor::flip() instead.

Flips an image resource. Internal use only.

No Hooks.

Return

resource. (maybe) flipped image resource.

Usage

_flip_image_resource( $img, $horz, $vert );
$img(resource) (required)
Image resource.
$horz(true/false) (required)
Whether to flip horizontally.
$vert(true/false) (required)
Whether to flip vertically.

Notes

  • See: WP_Image_Editor::flip()

Changelog

Since DEL 3.5.0 Introduced.

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

<?php
function _flip_image_resource( $img, $horz, $vert ) {
	_deprecated_function( __FUNCTION__, '3.5.0', 'WP_Image_Editor::flip()' );
	$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;
}