error_reporting(0);
include("functions.php");
$h1 = "DJ Mike's Image Maker 2";
$h2 = "Polaroid";
##### Start Polaroid
if ( $_GET[polaroid] == "Polaroid" )
{
$polaroid_angle = (float)trim( $_GET[polaroid_angle] );
#############
$image = new Imagick($_SESSION[path]);
$draw = new ImagickDraw();
## validate color 1##
if ($polaroid_bgcolor = trim($_GET[polaroid_bgcolor]) )
{
$polaroid_bgcolor = colors( $polaroid_bgcolor, "validate" );
if ( !$polaroid_bgcolor )
{ $error = "Background color is invalid"; }
}
## end validate 1 ##
## validate color 2 ##
if ($polaroid_bordercolor = trim($_GET[polaroid_bordercolor]) )
{
$polaroid_bordercolor = colors( $polaroid_bordercolor, "validate" );
if ( !$polaroid_bordercolor )
{ $error .= "Border color is invalid"; }
}
## end validate 2 ##
if ( $error )
{
$_SESSION[error] = $error;
header("location:$self");
}
foreach ($image as $frame)
{
$frame->setimagebordercolor( "$polaroid_bordercolor" );
$frame->setimagebackgroundcolor( "$polaroid_bgcolor" );
$frame->polaroidImage( $draw, $polaroid_angle);
}
$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[polaroid_angle] = $polaroid_angle;
$_SESSION[polaroid_bordercolor] = $polaroid_bordercolor;
$_SESSION[polaroid_bgcolor] = $polaroid_bgcolor;
header("Location: display.php");
exit;
}
######### end Polaroid
include("top.php");
?>