1 ) { $stroke_alpha = 1; } } # set stroke opacity if ($_GET[stroke_opacity]) { $stroke_opacity = trim($_GET[stroke_opacity] ); $stroke_opacity = (float)$stroke_opacity; if ( $stroke_opacity < 0 ) { $stroke_opacity = 0; } if ( $stroke_opacity > 1 ) { $stroke_opacity = 1; } } # set stroke fill opacity if ($_GET[fill_opacity]) { $fill_opacity = trim($_GET[fill_opacity] ); $fill_opacity = (float)$fill_opacity; if ( $fill_opacity < 0 ) { $fill_opacity = 0; } if ( $fill_opacity > 1 ) { $fill_opacity = 1; } } # set stroke fill alpha if ($_GET[fill_alpha]) { $fill_alpha = trim($_GET[fill_alpha] ); $fill_alpha = (float)$fill_alpha; if ( $fill_alpha < 0 ) { $fill_alpha = 0; } if ( $fill_alpha > 1 ) { $fill_alpha = 1; } } #### validate color ## if ( $_GET[fill_color] ) { $fill_color = trim($_GET[fill_color] ); $fill_color = colors( $fill_color, "validate" ); if ( !$fill_color ) { $error .= "Fill color is invalid
"; } } ## if ( $_GET[stroke_color] ) { $stroke_color = trim($_GET[stroke_color] ); $stroke_color = colors( $stroke_color, "validate" ); if ( !$stroke_color ) { $error .= "Stroke color is invalid
"; } } if ( $error ) { $_SESSION[error] = $error; header("location:$self"); } #### end validate colors ## #### if all vars set, make image & draw object $image = new Imagick($_SESSION[path]); $draw = new ImagickDraw; $ellipse_start = (float)$_GET[ellipse_start]; $ellipse_end = (float)$_GET[ellipse_end]; $skewX = (float)$_GET[draw_skew_x]; $skewY = (float)$_GET[draw_skew_y]; $scaleX = (float)$_GET[draw_scale_x]; $scaleY = (float)$_GET[draw_scale_y]; if ( $scaleX == 0 ) { $scaleX = 1; } $scaleY = (float)$_GET[draw_scale_y]; if ( $scaleY == 0 ) { $scaleY = 1; } $deg = (float)$_GET[draw_rotate]; if ( $_GET[ul_x] && $_GET[ul_y] && $_GET[w] && $_GET[h] && $_SESSION[path] && $_GET[action] == "Draw Ellipse" ) { $ul_x = (int)$_GET[ul_x]; $ul_y = (int)$_GET[ul_y]; $w = (float)$_GET[w]; $h = (float)$_GET[h]; $w = abs($w); $h = abs($h); # set colors if ( $fill_color ) { $draw->setfillcolor("$fill_color"); } if ( $stroke_color ) { $draw->setstrokecolor($stroke_color); } # set width $stroke_width = trim($_GET[stroke_width] ); $stroke_width = (int)$stroke_width; if ( $stroke_width ) { $draw->setstrokewidth($stroke_width); } # set stroke alpha/opacity & fill alpha/opacity if ( $stroke_alpha ) { $draw->setstrokealpha($stroke_alpha); } if ( $stroke_opacity ) { $draw->setstrokealpha($stroke_opacity); } if ( $fill_opacity ) { $draw->setfillalpha($fill_opacity); } if ( $fill_alpha ) { $draw->setfillalpha($fill_alpha); } $draw->skewx($skewX); $draw->skewy($skewY); $draw->rotate($deg); $draw->scale( $scaleX, $scaleY ); # set line cap switch ($_GET[line_cap]) { case "BUTT"; $cap = imagick::LINECAP_BUTT; break; case "ROUND"; $cap = imagick::LINECAP_ROUND; break; case "SQUARE"; $cap = imagick::LINECAP_SQUARE; break; default: $cap = imagick::LINECAP_UNDEFINED; } $draw->setStrokeLineCap($cap); ########## draw Ellipse ######### if ( $_GET[action] == "Draw Ellipse" ) { $draw->ellipse( $ul_x,$ul_y, $w, $h, $ellipse_start, $ellipse_end); foreach ($image as $frame) { $frame->drawimage($draw); } } ############################ $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[ellipse_start] = $ellipse_start; $_SESSION[ellipse_end] = $ellipse_end; $_SESSION[draw_scale_x] = $scaleX; $_SESSION[draw_scale_y] = $scaleY; $_SESSION[stroke_width] = $stroke_width; $_SESSION[fill_alpha] = $fill_alpha; $_SESSION[fill_opacity] = $fill_opacity; $_SESSION[stroke_alpha] = $stroke_alpha; $_SESSION[stroke_opacity] = $stroke_opacity; $_SESSION[path] = $path; $_SESSION[fill_color] = $fill_color; $_SESSION[stroke_color] = $stroke_color; $_SESSION[x_round] = $x_round; $_SESSION[y_round] = $y_round; $_SESSION[draw_rotate] = $deg; $_SESSION[draw_skew_x] = $skewX; $_SESSION[draw_skew_y] = $skewY; header("Location: display.php"); exit; # end draw } ############ step 2 # if 2nd coorids not set, set var for form if ( $_GET[crop_image_x] && $_GET[crop_image_y] && $_GET[ul_x] && $_GET[ul_y] && !$_GET[lr_x] && !$_GET[lr_y] ) { $ul_x = $_GET[ul_x]; $ul_y = $_GET[ul_y]; $lr_x = $_GET[crop_image_x]; $lr_y = $_GET[crop_image_y]; $ellipse_width = abs($lr_x-$ul_x); $ellipse_height = abs($lr_y-$ul_y); header("location:$self?ul_x=$ul_x&ul_y=$ul_y&w=$ellipse_width&h=$ellipse_height"); exit; } # Step 1. # Vars shouldn't be set at this point # if 1st coorids not set, set vars for form if ($_GET[crop_image_x] && $_GET[crop_image_y] && !$_GET[ul_x] && !$_GET[ul_x] && !$_GET[lr_x] && !$_GET[lr_x] ) { $ul_x = $_GET[crop_image_x]; $ul_y = $_GET[crop_image_y]; header("location:$self?ul_x=$ul_x&ul_y=$ul_y"); exit; } ?> <? echo "$h1: $h2"; ?>

"; echo "No image"; echo ""; } if ( isset($_SESSION[path]) ) { echo "
"; echo "
"; echo "
"; list($width, $height, $type, $attr) = getimagesize("$_SESSION[path]"); echo "

Width = $width; Height = $height
"; ### Show file size $filesize = filesize("$_SESSION[path]"); echo "File size: $filesize bytes
Your Image
"; } ?>

Point 1
Width Height
Point 2
*/ ?> Start End Fill Color Stroke Color Stroke Width Stroke Opacity Fill Opacity Stroke Alpha Fill Alpha
Skew
 
Scale
Rotate

Ellipses

Arcs are described by a center point, a width, a height a starting angle and an end angle.

Instructions

  1. Click center of ellipse
    or
    Enter the x,y cooridinates of center of ellipse
  2. Click a corner of the bounding box of the ellipse and the width and height will be calculated for you
    or
    Enter the width and height
  3. Enter starting angle.
  4. Enter end angle.
  5. Enter Stroke Color. Can be valid color name or hex.
  6. Enter Stroke Width. (optional)
  7. Select Line Cap style for lines. (optional)
  8. Enter Fill Color for shapes. Can be valid color name or hex.(optional).
  9. Enter Stroke Opacity. Range: 0-1 (optional)
  10. Enter Stroke Alpha. Range: 0-1 (optional)
  11. Enter Fill Opacity. Range: 0-1 (optional)
  12. Enter Fill Alpha. Range: 0-1 (optional)
  13. Click Make Ellipse.
  14. Your settings (except for cooridinates) will be saved. Clicking Reset will delete your settings
Fill Color
The color Inside the ellipse
Stroke Color
The color of the lines
Stroke Width
The thickness of the lines
Line Cap
How the lines end.
Stroke Alpha
Fill Alpha
Fill Alpha
Fill Opacity
Rotate
Rotate draw object
Skew
Skews the shape. Enter degrees of skew.
Scale
Stretch the shape. 1 for unchanged. 2 to double etc
*/ ?>