<?php
$image = imagecreatefromgif("image/img32.gif");
imageMove($image, "up");
function imageMove($image, $move)
{
$w = imagesx($image);
$h = imagesy($image);
$data = imagecreate($w, $h);
$n=0;
if ($move=="up")
{
for ($y = 0; $y < $h; $y+=2)
{
$n++;
for ($x = 0; $x < $y; $x++)
imagecopy($data, $image, 0, $h-$y, 0, 0, $w, $x);
imagecopy($data, $image, 0, 0, 0, $y, $w, $h-$y);
imagegif($data, "test_".$move."-".$n.".gif");
}
}
else if ($move=="down")
{
for ($y = $h; $y > 0; $y-=2)
{
$n++;
for ($x = 0; $x < $y; $x++)
imagecopy($data, $image, 0, $h-$y, 0, 0, $w, $x);
imagecopy($data, $image, 0, 0, 0, $y, $w, $h-$x);
imagegif($data, "test_".$move."-".$n.".gif");
}
}
else if ($move=="left")
{
for ($y = 0; $y < $w; $y+=2)
{
$n++;
for ($x = 0; $x < $y; $x++)
imagecopy($data, $image, $w-$y, 0, 0, 0, $x, $h);
imagecopy($data, $image, 0, 0, $y, 0, $w-$y, $h);
imagegif($data, "test_".$move."-".$n.".gif");
}
}
else if ($move=="right")
{
for ($y = $w; $y > 0; $y-=2)
{
$n++;
for ($x = 0; $x < $y; $x++)
imagecopy($data, $image, $w-$y, 0, 0, 0, $x, $h);
imagecopy($data, $image, 0, 0, $y, 0, $w-$x, $h);
imagegif($data, "test_".$move."-".$n.".gif");
}
}
else echo "Error";
}
?>
|