note 13544 modified in ref.image by tom
| From: | tom@php.net | Date: | Wed, 08 May 2002 10:32:28 +0000 |
| Subject: | note 13544 modified in ref.image by tom | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-30325@lists.php.net to get a copy of this message | ||
Is there some easier way of flipping an image other than by copying the old one pixel by pixel?
function flip($oldIm)
{
$width=ImageSX($oldIm);
$height=ImageSY($oldIm);
$newIm=ImageCreate($width, $height);
for($i=0; $i<$width; $i++)
{
for($j=0;$j<$height;$j++)
{
ImageCopy($newIm, $oldIm, $i, $j, $i, $height-1-$j, 1, 1);
}
}
return $newIm;
}
--was--
Is there some easier way of flipping an image other than by copying the old one pixel by pixel?
function flip($oldIm)
{
$width=ImageSX($oldIm);
$height=ImageSY($oldIm);
$newIm=ImageCreate($width, $height);
for($i=0; $i<$width; $i++)
{
for($j=0;$j<$height;$j++)
{
ImageCopy($newIm, $oldIm, $i, $j, $i, $height-1-$j, 1, 1);
}
}
return $newIm;
}
http://www.php.net/manual/en/ref.image.php