_flip_image_resource()
Deprecated from version 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.
Internal function — this function is designed to be used by the kernel itself. It is not recommended to use this function in your code.
No Hooks.
Return
resource|GdImage
. (maybe) flipped image resource or GdImage instance.
Usage
_flip_image_resource( $img, $horz, $vert );
- $img(resource|GdImage) (required)
- Image resource or GdImage instance.
- $horz(true|false) (required)
- Whether to flip horizontally.
- $vert(true|false) (required)
- Whether to flip vertically.
Notes
Changelog
Since 2.9.0 | Introduced. |
Deprecated since 3.5.0 | Use WP_Image_Editor::flip() |
_flip_image_resource() flip image resource code WP 6.6.2
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_gd_image( $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; }