Re: [PHP] how to flip an image using GD?

2001-06-30 Thread Hugh Bothwell

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 [EMAIL PROTECTED] wrote in message
9hi9v6$hn$[EMAIL PROTECTED]">news:9hi9v6$hn$[EMAIL PROTECTED]...
 how would i flip an image horizontally using the GD library in PHP?




-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP] how to flip an image using GD?

2001-06-29 Thread Noah Spitzer-Williams

how would i flip an image horizontally using the GD library in PHP?

Noah



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]