error_reporting(0);
include("functions.php");
$h1 = "DJ Mike's Image Maker 2";
$h2 = "Charcoal";
##### Start charcoal
if ( $_GET[charcoal_radius] && $_GET[charcoal_sigma] )
{
$charcoal_radius = trim( $_GET[charcoal_radius] );
$charcoal_sigma = trim( $_GET[charcoal_sigma] );
##### Validate radius & sigma
if ( preg_match( "#[^0-9\-\.]#", "$charcoal_radius", $x) )
{
$_SESSION[error] = "Radius has numbers only";
exit;
}
if ( preg_match( "#[^0-9\-\.]#", "$charcoal_sigma", $x) )
{
$_SESSION[error] .= "
Sigma has numbers only";
exit;
}
if ( $_SESSION[error] ) { header("location:$self"); }
#############
$image = new Imagick($_SESSION[path]);
foreach ($image as $frame)
{ $frame->charcoalImage($charcoal_radius, $charcoal_sigma); }
$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[charcoal_radius] = $charcoal_radius;
$_SESSION[charcoal_sigma] = $charcoal_sigma;
header("Location: display.php");
exit;
}
######### end charcoal
include("top.php");
?>