Re: how to flip an image using GD?
| From: | Hugh Bothwell | Date: | Sat, 30 Jun 2001 01:01:20 +0000 |
| Subject: | Re: how to flip an image using GD? | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-55615@lists.php.net to get a copy of this message | ||
I don't see any function for this in GD; it looks like you'll have to either
find a third-party library or do it pixel-by-pixel, something like
<?php
$width = imagesx($img);
$height = imagesy($img);
for ($j = 0; $j < $height; $j++) {
$left = 0;
$right = $width-1;
while ($left < $right) {
$t = imagecolorat($img, $left, $j);
imagesetpixel($img, $left, $j, imagecolorat($img, $right, $j));
imagesetpixel($img, $right, $j, $t);
$left++; $right--;
}
}
?>
(obviously, a library would be faster, but would essentially do the same
thing).
""Noah Spitzer-Williams"" <noahsw@studentcenter.org> wrote in message
news:9hi9v6$hn$1@w153.z064000151.sjc-ca.dsl.cnc.net...
> how would i flip an image horizontally using the GD library in PHP?