"; $error_bad_len = "Wave length is numbers only.
"; ##### Validate ampltude & wave length if ( preg_match( "#[^0-9\-\.]#", "$wave_amplitude", $x) ) { $error .= "$error_bad_amp"; } if ( preg_match( "#[^0-9\-\.]#", "$wave_length", $x) ) { $error .= "$error_bad_len"; } if ( $error != "" ) { echo "$errormsgtop"; echo "$error"; echo "$errormsgbottom"; exit; } # end validation $wave_amplitude = (float)$wave_amplitude; $wave_length = (float)$wave_length; # make imagick object $image = new Imagick($_SESSION[path]); # if bgcolor entered then validate if ($_GET[wave_bgcolor]) { # trim input $wave_bgcolor = trim($_GET[wave_bgcolor]); ## validate color if ( !key_exists( "$wave_bgcolor", $color_names) && ( !preg_match( "@#[0-9a-f]{6}@i", $wave_bgcolor, $b) || strlen($wave_bgcolor) != 7 ) ) { $error .= "Color is invalid."; } # if invalid, error msg & exit if ( $error != "") { echo "$errormsgtop $error $errormsgbottom"; exit; } ## end validate } # if no color entered, set to transparent else { $wave_bgcolor = "transparent"; } # do the wave foreach ( $image as $frame ) { $frame->setimagebackgroundcolor("$wave_bgcolor"); $frame->waveImage($wave_amplitude, $wave_length); } ############# # write image xxx $format = strtolower( $image->getimageformat() ); $path = "temp/$ID.$_SESSION[views].$format"; $image->writeimages("$path", TRUE ); # save settings & exit $_SESSION[path] = $path; $_SESSION[wave_amplitude] = $wave_amplitude; $_SESSION[wave_length] = $wave_length; $_SESSION[wave_bgcolor] = $wave_bgcolor; header("Location: display.php?url=$path"); exit; } ######### end wave include("top.php"); ?>

">
Wave Amplitude: ">
Wave Length: ">
Background Color (optional) ">


Description
Reshapes the image into a sine wave
Amplitude
Amplitude of sine wave in pixels
Wave length
Wave length of sine wave in pixels
Background color
Optional. Color of the troughs between the wave peeks. Can be a named color or hex preceded by a #. Examples: red, #ff0000. If Background color is left blank it defaults to transparent for GIF's and PNG's; black for JPEG's.