"; $error_width = "You did not enter a width
"; $width_invalid = "You entered an invalid width
"; $height_invalid = "You entered an invalid height
"; $error_height = "You did not enter a height
"; $error_no_color = "You did not enter a color
"; $error_bad_color = "You entered an invalid color
"; $error_in_bevel = "You did not enter a valid inner bevel width
"; $error_out_bevel = "You did not enter a valid outer bevel width
"; $error_no_in_bevel = "You did not enter an inner bevel width
"; $error_no_out_bevel = "You did not enter an outer bevel width
"; if ( !isset($_GET[decoration]) ) { $error .= $no_function; } if ( $_GET[decoration_width] == "" ) { $error .= $error_width; } if ( preg_match( "#\D#", "$_GET[decoration_width]", $x) ) { $error .= $width_invalid; } if ( $_GET[decoration_height] == "" ) { $error .= $error_height; } if ( preg_match( "#\D#", "$_GET[decoration_height]", $x) ) { $error .= $height_invalid; } # Make image if no error so far & get forrmat & count frames if ( $error ) { $_SESSION[error] = $error; header("location:$self"); } else { $image = new Imagick($_SESSION[path]); $format = strtolower( $image->getimageformat() ); $path = "temp/$ID.$_SESSION[views].$format"; $frames = $image->getNumberImages(); } if ( $_GET[decoration] == "raise" ) { foreach ($image as $frame) { $frame->raiseImage( $_GET[decoration_width], $_GET[decoration_height], 0, 0, TRUE ); } } if ( $_GET[decoration] == "sink" ) { # error check if ( preg_match( "#\D#", "$_GET[decoration_width]", $x) ) { $error .= $width_invalid; } if ( preg_match( "#\D#", "$_GET[decoration_height]", $x) ) { $error .= $height_invalid; } if ( $error ) { $_SESSION[error] = $error; header("location:$self"); } foreach ($image as $frame) { $frame->raiseImage( $_GET[decoration_width], $_GET[decoration_height], 0, 0, FALSE ); } } # end sink #### validate color #### if ( ( $_GET[decoration] == "border" ) || ( $_GET[decoration] == "frame" ) ) { $color = trim($_GET[decoration_color] ); $color = colors( $color, "validate" ); if ( !$color ) { $_SESSION[error] = "Color is invalid"; header("location:$self"); exit; } # $color = (string)$color; } #### end validate #### if ( $_GET[decoration] == "border" ) { foreach ($image as $frame) { $frame->borderimage( $color, $_GET[decoration_width], $_GET[decoration_height]); } #### validate bevel widths if ( preg_match( "#[^\d]#", $_GET[in_bevel], $x) ) { $error .= $error_in_bevel; } if ( preg_match( "#[^\d]#", $_GET[out_bevel], $x) ) { $error .= $error_out_bevel; } if ( $_GET[in_bevel] == "" ) { $error .= $error_no_in_bevel; } if ( $_GET[out_bevel] == "" ) { $error .= $error_no_out_bevel; } if ( $error ) { $_SESSION[error] = $error; header("location:$self"); } } #### Frame if ( $_GET[decoration] == "frame" ) { # xxx foreach ($image as $frame) { $feame->frameimage( $color, $_GET[decoration_width], $_GET[decoration_height], $_GET[in_bevel], $_GET[out_bevel]); } } # last check for bad input if ( $error ) { $_SESSION[error] = $error; header("location:$self"); } ## finish if ( $frames> 1) { $image->writeImages("$path", TRUE); } else { $image->writeImage("$path"); } # save settings $_SESSION[path] = $path; $_SESSION[decoration_width] = $_GET[decoration_width]; $_SESSION[decoration_height] = $_GET[decoration_height]; $_SESSION[decoration_color] = $color; $_SESSION[in_bevel] = $_GET[in_bevel]; $_SESSION[out_bevel] = $_GET[out_bevel]; header("Location: display.php"); } ################################## include("top.php"); ?>
Function Parameters
Width Height Color Inner
Bevel
Outer
Bevel
"> "> "> "> ">


Frame
Border
Raise
Sink