WordPress Version: 5.6
/**
* Flips an image resource. Internal use only.
*
* @since 2.9.0
* @deprecated 3.5.0 Use WP_Image_Editor::flip()
* @see WP_Image_Editor::flip()
*
* @ignore
* @param resource|GdImage $img Image resource or GdImage instance.
* @param bool $horz Whether to flip horizontally.
* @param bool $vert Whether to flip vertically.
* @return resource|GdImage (maybe) flipped image resource or GdImage instance.
*/
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;
}