error_reporting(0);
include("functions.php");
$h1 = "DJ Mike's Image Maker 2";
$h2 = "Gradient";
##### start gradient
$error = "";
if ( isset($_GET[submit]) )
{
$width = (int)$_GET[gradient_width];
if ( $width<1)
{ $width = 1; }
if ( $width>550)
{ $error .= "Width too big.
"; }
$height = (int)$_GET[gradient_height];
if ( $height<1)
{ $height = 1; }
if ( $height>550)
{ $error .= "Height too big.
"; }
## validate color ##
$color_1 = trim($_GET[gradient_color_1]);
$color_1 = colors( $color_1 , "validate" );
if ( !$color_1 )
{ $error .= "Top Color is invalid
"; }
## end validate ##
## validate color ##
$color_2 = trim($_GET[gradient_color_2]);
$color_2 = colors( $color_2, "validate" );
if ( !$color_2 )
{ $error .= "Bottom Color is invalid"; }
## end validate ##
if ( $error )
{
$_SESSION[error] .= "$error";
header("location:$self");
exit;
}
##
$image = new Imagick();
$image->newPseudoImage( $width, $height, "gradient:$color_1-$color_2" );
$image->setImageFormat("$_GET[gradient_image_type]");
$path = "temp/$ID.$_SESSION[views].$_GET[gradient_image_type]";
## save settings
$_SESSION[gradient_width] = $width;
$_SESSION[gradient_height] = $height;
$_SESSION[gradient_color_1] = $color_1;
$_SESSION[gradient_color_2] = $color_2;
$_SESSION[path] = "$path";
$_SESSION[type] = "$_GET[gradient_image_type]";
# make image
$image->writeimage("$path");
$_SESSION[path] = $path;
header("Location: display.php");
exit;
}
######### end gradient ########
include("top.php");
?>