%%image-resize-editor-html%%

%%preprocess%%
$this->beryliumToForm(); 
$this->timeFormat('D, M j, Y, \a\t H:i:s');

$tags= "";
$postvars= $GLOBALS['HTTP_POST_VARS'];

if ($postvars['newwidth']=="") $this->newwidth= $this->width;
else $this->newwidth= $postvars['newwidth'];
if ($postvars['newheight']=="") $this->newheight= $this->height;
else $this->newheight= $postvars['newheight'];
if ($postvars['quality']=="") $this->quality= 75;
else $this->quality= $postvars['quality'];
$tags.= "&width=$this->newwidth&height=$this->newheight&quality=$this->quality";

if ($postvars['modulatebri']=="") $this->modulatebri= 100;
else $this->modulatebri= $postvars['modulatebri'];
if ($postvars['modulatesat']=="") $this->modulatesat= 100;
else $this->modulatesat= $postvars['modulatesat'];
if ($postvars['modulatehue']=="") $this->modulatehue= 100;
else $this->modulatehue= $postvars['modulatehue'];
$tags.= "&modulatebri=$this->modulatebri&modulatesat=$this->modulatesat&modulatehue=$this->modulatehue";

if ($postvars['gaussian']=="") $this->gaussian= 0; 
else {
	$this->gaussian= $postvars['gaussian'];
	if ($postvars['gaussiansigma']=="") $this->gaussiansigma= 0;
	else $this->gaussiansigma= $postvars['gaussiansigma'];
	$tags.= "&gaussian=$this->gaussian&gaussiansigma=$this->gaussiansigma";
	}
	
if ($postvars['sharpen']=="") $this->sharpen= 0;
else {
	$this->sharpen= $postvars['sharpen'];
	if ($postvars['sharpensigma']=="") $this->sharpensigma= 0;
	else $this->sharpensigma= $postvars['sharpensigma'];
	$tags.= "&sharpen=$this->sharpen&sharpensigma=$this->sharpensigma";
	}
	
if ($postvars['spread']=="") $this->spread= 0;
else {
	$this->spread= $postvars['spread'];
	$tags.= "&spread=$this->spread";
	}
	
if ($postvars['median']=="") $this->median= 0;
else {
	$this->median= $postvars['median'];
	$tags.= "&median=$this->median";
	}

if ($postvars['exact']=="") $this->exact= 0;
else {
	$this->exact= $postvars['exact'];
	$tags.= "&exact=$this->exact";
	}
$eexact= "exact$this->exact";
$this->{$eexact}= "checked";

if ($postvars['rotate']=="") $this->rotate= 0;
else {
	$this->rotate= $postvars['rotate'];
	$tags.= "&rotate=$this->rotate";
	}
$erotate= "rotate$this->rotate";
$this->{$erotate}= "checked";

if ($postvars['flop']=="") $this->flop= 0;
else {
	$this->flop= $postvars['flop'];
	$tags.= "&flop=$this->flop";
	}
$eflop= "flop$this->flop";
$this->{$eflop}= "checked";

if ($postvars['normalize']=="") $this->normalize= 0;
else {
	$this->normalize= $postvars['normalize'];
	$tags.= "&normalize=$this->normalize";
	}
$enormalize= "normalize$this->normalize";
$this->{$enormalize}= "checked";

if ($postvars['negate']=="") $this->negate= 0;
else {
	$this->negate= $postvars['negate'];
	$tags.= "&negate=$this->negate";
	}
$enegate= "negate$this->negate";
$this->{$enegate}= "checked";

if ($postvars['monochrome']=="") $this->monochrome= 0;
else {
	$this->monochrome= $postvars['monochrome'];
	$tags.="&monochrome=$this->monochrome";
	}
$emonochrome= "monochrome$this->monochrome";
$this->{$emonochrome}= "checked";

if ($postvars['submit']=="resize") {
	$this->generating= "<p align=center class=notice>Generating preview now</p>";
	$this->previewTag= "<img src=\"$this->uri?method=mogrify$tags\" alt='preview at new size' title='preview at new size' onLoad=\"window.location='#preview';\">";
	}
else $this->previewTag= "Please fill in values above and click <tt>resize</tt>.";

if ($this->id!="") {
	$this->hiddenvars= "<input type='hidden' name='id' value=\"$this->id\">";
	}

// proper icon
if (!$this->public) $this->iconpvt= "-pvt";

// get this->filesize
if (file_exists($this->path)) {
	$size= filesize($this->path);
	if ($size<1024) {
		$this->filesize= "$size Bytes";
		}
	elseif ($size < 1048576) {
		$size= $size/1024;
		$size= round($size,2);
		$this->filesize= "$size KB";
		}
	else	{
		$size= $size/1048576;
		$size= round($size,2);
		$this->filesize= "$size MB";
		}
	}
else {
	$this->filesize= "file not found!";
	}
	
// setup for thumbnail
$this->proportion(150,100);
	
%%header%%


%%css%%
.notice	{color: #ff0000; }
.editorinfo {font-size: 12px; color: #999999; }
.editorinfo b {font-size: 12px; color: #aa9999; font-weight: bold; }

.imagetable TD {padding: 0px; margin: 0px; }
.imageflavor {font-size: 12px; }
.imagetitle {font-size: 18px; font-weight: bold; color: #006699; }
.imagebyline {font-size: 12px; line-height: 18px; }
.imagedescription {font-size: 12px; line-height: 18px; }

%%template%%
$this->generating
<table border=0 class=imagetable>
	<tr>
		<td width='20'><img src='/bicons/spacer.png' border=0 alt=image width=20 height=1></td>
		<td><span class='imageflavor'>$this->flavor:</span></td>
		<td width='150' rowspan='3' align=center valign=middle><img src='$this->uri' width='$this->width' height='$this->height' alt='original image, scaled to thumbnail' title='original image, scaled to thumbnail'></td>
	</tr>
	<tr>
		<td colspan=2>
			<span class='imagetitle'>
			<img src='/bicons/image$this->iconpvt.png' border=0 alt='image:$this->id' title='image:$this->id' align=absmiddle>
			$this->title</span>
		</td>
	</tr>
	<tr>
		<td>&nbsp;</td>
		<td><span class='imagebyline'>By $this->author on $this->created.</span>
			<span class='editorinfo'><br>Filesize: $this->filesize | Image size: $this->origWidth x $this->origHeight pixels</span> 
		</td>
	</tr>
</table>
<form method='post' action='$this->baseURL?method=resize$session->cgi' class='.form'>
$this->hiddenvars
<table border='0'>
<tr>
	<td colspan=2><b>Resize Options</b></td>
</tr>
<tr>
	<td align='right' valign='top'>new width:</td>
	<td valign='top'><input type='text' name='newwidth' size='4' maxlength='255' value="$this->newwidth"> pixels</td>
</tr>
<tr>
	<td align='right' valign='top'>new height:</td>
	<td valign='top'><input type='text' name='newheight' size='4' maxlength='255' value="$this->newheight"> pixels</td>
</tr>
<tr>
	<td align='right' valign='top'>resize type:</td>
	<td valign='top'>
		<input type="radio" name="exact" value="0" $this->exact0>proportional (fit within width x height)<br>
		<input type="radio" name="exact" value="1" $this->exact1>exact (make exactly width x height)
	</td>
</tr>
<tr>
	<td colspan=2><b>Compression Options</b></td>
</tr>
<tr valign='top'>
	<td align='right'>compression level:</td>
	<td><table>
		<tr>
			<td align=left valign=top width=1%><input type='text' name='quality' size='3' maxlength='3' value="$this->quality"></td>
			<td align=left width=99%>100: highest quality, larger filesize <br>
				&nbsp;75: standard quality<br>
				&nbsp;&nbsp;1: lowest quality,smaller filesize
				</td>
		</tr>
	</table></td>
</tr>
<tr>
	<td colspan=2><b>Rotate Options</b></td>
</tr>
<tr>
	<td align='right' valign='top'>rotate:</td>
	<td valign='top'><input type="radio" name="rotate" value="0" $this->rotate0>0&deg; | <input type="radio" name="rotate" value="90" $this->rotate90>90&deg; | <input type="radio" name="rotate" value="180" $this->rotate180>180&deg; | <input type="radio" name="rotate" value="270" $this->rotate270>270&deg;</td>
</tr>
<tr>
	<td align='right' valign='top'>mirror:</td>
	<td valign='top'><input type=hidden name=flop value=0><input type="checkbox" name="flop" value="1" $this->flop1> (flops image left-&gt;right)</td>
</tr>
<tr>
	<td colspan=2><b>Color Options</b></td>
</tr>
<tr>
	<td align='right' valign='top'>brightness:</td>
	<td valign='top'><input type='text' name='modulatebri' size='3' maxlength='255' value="$this->modulatebri">%</td>
</tr>
<tr>
	<td align='right' valign='top'>saturation:</td>
	<td valign='top'><input type='text' name='modulatesat' size='3' maxlength='255' value="$this->modulatesat">%</td>
</tr>
<tr>
	<td align='right' valign='top'>hue:</td>
	<td valign='top'><input type='text' name='modulatehue' size='3' maxlength='255' value="$this->modulatehue">%</td>
</tr>
<tr>
	<td align='right' valign='top'>normalize:</td>
	<td valign='top'><input type=hidden name=normalize value=0><input type="checkbox" name="normalize" value="1" $this->normalize1> (contrast enhancement)</td>
</tr>
<tr>
	<td align='right' valign='top'>monochrome:</td>
	<td valign='top'><input type=hidden name=monochrome value=0><input type="checkbox" name="monochrome" value="1" $this->monochrome1> (makes image black-and-white)</td>
</tr>
<tr>
	<td align='right' valign='top'>negative:</td>
	<td valign='top'><input type=hidden name=negate value=0><input type="checkbox" name="negate" value="1" $this->negate1></td>
</tr>
<tr>
	<td colspan=2><b>Blur/Sharpen Options</b></td>
</tr>
<tr>
	<td align='right' valign='top'>gaussian blur:</td>
	<td valign='top'>radius <input type='text' name='gaussian' size='3' maxlength='255' value="$this->gaussian"> pixels with <input type='text' name='gaussiansigma' size='3' maxlength='255' value="$this->gaussiansigma"> deviation</td>
</tr>
<tr>
	<td align='right' valign='top'>sharpen:</td>
	<td valign='top'>radius <input type='text' name='sharpen' size='3' maxlength='255' value="$this->sharpen"> pixels with <input type='text' name='sharpensigma' size='3' maxlength='255' value="$this->sharpensigma"> deviation</td>
</tr>
<tr>
	<td align='right' valign='top'>pixel spread:</td>
	<td valign='top'><input type='text' name='spread' size='3' maxlength='255' value="$this->spread"> pixels</td>
</tr>
<tr>
	<td align='right' valign='top'>median filter:</td>
	<td valign='top'><input type='text' name='median' size='1' maxlength='255' value="$this->median"> 0-6</td>
</tr>
<tr> 
	<td width=10%>&nbsp;</td>
	<td width=90%><input type='submit' name='submit' value='resize' class='buttonstyle'></td>
</tr>
</table>
</form>
<table border=0 class=imagetable>
	<tr>
		<td width='1%'><img src='/bicons/spacer.png' border=0 alt=image width=20 height=1></td>
		<td width='99%'>
			<p class='imageflavor'><span class='imagetitle'>Preview: </span><a name='preview'> </a><br>
			A preview will be generated using the settings above every time you click <tt>resize</tt>. To permanently resize the image, click <tt>commit</tt> below.<br>
			<b>Please be patient</b>, it may take up to a minute for berylium to generate the new image...</p></td>
	</tr>
	<tr>
		<td colspan=2>&nbsp;</td>
	</tr>
	<tr>
		<td colspan=2 align=center>
			$this->previewTag
		</td>
	</tr>
	<tr>
		<td colspan=2>&nbsp;</td>
	</tr>
	<tr>
		<td>&nbsp;</td>
		<td><form method='post' action='$this->uri?method=mogrify$session->cgi' class='.form'>
				$this->hiddenvars
				<input type=hidden name=width value='$this->newwidth'>
				<input type=hidden name=height value='$this->newheight'>
				<input type=hidden name=exact value='$this->exact'>
				<input type=hidden name=quality value='$this->quality'>
				When this image is sized correctly, click: <input type='submit' name='submit' value='commit' class='buttonstyle'> (will resize the image permanently).
			</form>
		</td>
	</tr>
</table>
%%listrow%%
 

%%nullobject%%
<img src='/bicons/warning.png' alt='Warning' align=absmiddle> Sorry, that image is not available for editing. 

%%footer%%


%%postprocess%%


%%end of context%% 
