error_reporting(0);
include("functions.php");
$h1 = "DJ Mike's Image Maker 2";
$h2 = "Swirl";
##### Start swirl
if ( $_GET[deg] )
{
$deg = trim($_GET[deg]);
##### Validate degrees
if ( preg_match( "#[^0-9\-]#", "$deg", $x) )
{ $_SESSION[error] = "Degrees have numbers only";
header("location:self");
exit; }
#############
$image = new Imagick($_SESSION[path]);
foreach ($image as $frame)
{ $frame->swirlimage($deg); }
$format = strtolower( $image->getimageformat() );
$path = "temp/$ID.$_SESSION[views].$format";
$frames = $image->getNumberImages();
if ( $frames > 1) { $image->writeImages("$path", TRUE); }
else { $image->writeImage("$path"); }
# save settings
$_SESSION[path] = $path;
$_SESSION[deg] = $deg;
header("location:display.php");
exit;
}
######### end swirl
include("top.php");
?>