PHP Code:
Here's an alternative image-flipping function which is simpler than either of the ones
I've seen in the docs here. It takes the source image and the mode (zero for horizontal,
nonzero for vertical) and returns the flipped image.
<?php
function imageflip($image, $mode) {
$w = imagesx($image);
$h = imagesy($image);
$flipped = imagecreate($w, $h);
if ($mode) {
for ($y = 0; $y < $h; $y++) {
imagecopy($flipped, $image, 0, $y, 0, $h - $y - 1, $w, 1);
}
} else {
for ($x = 0; $x < $w; $x++) {
imagecopy($flipped, $image, $x, 0, $w - $x - 1, 0, 1, $h);
}
}
return $flipped;
}
?>
From: http://www.php.net/imagecopy
Bookmarks