private static function imageflip(&$result, &$img, $rx = 0, $ry = 0, $x = 0, $y = 0, $size_x = null, $size_y = null)
{
if ($size_x < 1) {
$size_x = imagesx($img);
}
if ($size_y < 1) {
$size_y = imagesy($img);
}
imagecopyresampled($result, $img, $rx, $ry, $x + $size_x - 1, $y, $size_x, $size_y, 0 - $size_x, $size_y);
}