#error_reporting(0);
include("functions.php");
$h1 = "DJ Mike's Image Maker 2";
$h2 = "Plasma";
if ( $_GET[color] || $_GET[fractal] )
{
if ( isset($_GET[plasma_x]) )
{ $x = (int)$_GET[plasma_x]; }
else { $plasma_x = 1; }
if ( $x<1 )
{ $x = 1; }
if ( isset($_GET[plasma_y]) )
{ $y = (int)$_GET[plasma_y]; }
else { $plasma_y = 1; }
if ( $y < 1 )
{ $y = 1; }
if ( $x>550)
{ $error .= "Width must be from 0 to 550
"; }
if ( $y>550)
{ $error .= "Height must be from 0 to 550
"; }
if ( $error )
{
$_SESSION[error] = "$error";
header("location:$self");
exit;
}
$image = new Imagick();
if ( $_GET[fractal] )
{ $image->newPseudoImage( $x, $y, "plasma:fractal" ); }
if ( $_GET[color] )
{
## validate color ##
$fractal_color_1 = trim( $_GET[fractal_color_1] );
$fractal_color_1 = colors( $fractal_color_1, "validate" );
if ( !$fractal_color_1 )
{
$error .= "Color 1 is invalid
";
exit;
}
## end validate ##
## validate color 2 ##
$fractal_color_2 = trim( $_GET[fractal_color_2] );
$fractal_color_2 = colors( $fractal_color_2, "validate" );
if ( !$fractal_color_2 )
{
$error .= "Color 2 is invalid
";
exit;
}
## end validate ##
if ( $error )
{
$_SESSION[error] = "$error";
header("location:$self");
exit;
}
## end validate
$image->newPseudoImage( $x, $y, "plasma:$fractal_color_1-$fractal_color_2" );
}
$image->setImageFormat($_GET[plasma_format]);
$path = "temp/$ID.$_SESSION[views].$_GET[plasma_format]";
$image->writeimage("$path");
$_SESSION[path] = $path;
$_SESSION[format] = "$_GET[plasma_format]";
$_SESSION[plasma_x] = $x;
$_SESSION[plasma_y] = $y;
$_SESSION[fractal_color_1] = $_GET[fractal_color_1];
$_SESSION[fractal_color_2] = $_GET[fractal_color_2];
header("Location: display.php");
exit;
}
include("top.php");
?>
Create a new plasma image. Enter width, height and image format. For color plasma, colors can be named colors like red or a hex like #0000ff.