Color is invalid"; header("location:$self"); exit; } } if ( $error ) { $_SESSION[error] = $error; header("location:$self"); #echo "$error"; exit; } else { $blob = file_get_contents("$_SESSION[path]"); $type = "$_SESSION[type]"; $image = new imagick(); $image->readImageBlob("$blob"); $width = $image->getImageWidth(); $height = $image->getImageheight(); # Get iterator foreach ($image as $frame) { $it = $image->getPixelIterator(); $x = 0; $y = 0; # Loop through pixel rows foreach( $it as $row => $pixels ) { $y++; # Loop trough the pixels in the row (columns) foreach ( $pixels as $column => $pixel ) { $x++; # find shortest distance to an edge $dist = min( abs($x-$width), $x, abs($y-$height), $y ); $sin = ($dist/$bevel_width); $theta = asin($sin); $cos = cos($theta); if ( $_GET[bevel_type] == "frame" ) { $bevel = $cos; } else { $bevel = $sin; } if ( $bevel >1 ) { $bevel = 1; } # get a pixel object $point = $image->getImagePixelColor( $x, $y); # get color as array $color = $point->getColor(); $r = $color[r]*$bevel; $g = $color[g]*$bevel; $b = $color[b]*$bevel; # Paint pixel if ( !$bevel_color && $dist>$bevel_width ) { $pixel->setColor( "rgb( $color[r], $color[g], $color[b])" ); } elseif ( $bevel_color && $dist>$bevel_width ) { $pixel->setColor( "$bevel_color" ); } else { $pixel->setColor( "rgb($r,$g,$b)" ); } } $x = 0; $it->syncIterator(); } } $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[bevel_width] = $bevel_width; $_SESSION[bevel_type] = $_GET[bevel_type]; $_SESSION[bevel_color] = $bevel_color; $_SESSION[path] = "$path"; header("Location: display.php?url=$path"); exit; } } #### End Buttonize include("top.php"); ?>

Bevel Width: ">
Fill Color ">

Discription

Creates a rounded bevel around the image with an optional fill.

Examples


Starting image

Button

Filled Button

Frame

Filled Frame

Instructions

  1. Enter the bevel width in pixels
  2. Select a bevel type.
  3. Fill color is optional. Fill color can be a named color like red or a hex like #0000ff.