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

February 12, 2011 


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