<%@ Language="VBScript" %>
<!--#include file="../config.asp"-->
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
	<title>Aurigma Image Uploader Demos &mdash; Optimized Upload Demo</title>

	<link href="../common.css" type="text/css" rel="stylesheet" />

	<script type="text/javascript" src="../Scripts/iuembed.js"></script>
	<script type="text/javascript" src="../Scripts/iuembed.InstallationProgress.js"></script>

	<script type="text/javascript">
//<![CDATA[	
//This UploadFileCountChange event handler displays total size of all files selected for upload.
function ImageUploader1_UploadFileCountChange() {
	var imageUploader1 = getImageUploader('ImageUploader1');
	if (imageUploader1) {
		document.getElementById("TotalSourceFileSize").value = Math.ceil(imageUploader1.getTotalFileSize() / 1024);
	}
}

//Add form field
function ImageUploader1_BeforeUpload() {
	var imageUploader1 = getImageUploader("ImageUploader1");
	if (imageUploader1) {
		imageUploader1.AddField("TotalSourceFileSize", Math.ceil(imageUploader1.getTotalFileSize() / 1024));
	}
}

//This Progress event handler demonstrates an alternative way to 
//redirect upon upload (instead of RedirectUrl property).
function ImageUploader1_Progress(Status, Progress, ValueMax, Value, StatusText) {
	if (Status=="COMPLETE") {
		window.location = "gallery.asp";  
	}
} 

//]]>
	</script>

</head>
<body>
	<form>
		<h1><a href="../default.asp">Aurigma Image Uploader Demos</a> &rarr; Optimized Upload Demo</h1>
		<p>
			This demo application shows that Image Uploader can be used not just for file transmission,
			but also for traffic optimization. Resized version of a photo is sent to the server
			instead of the original file. Another Image Uploader features demonstrated here
			are:
		</p>
		<ul>
			<li>Automatic photo rotation depending on EXIF information in the file.</li>
			<li>File filters (extension, image dimensions).</li>
			<li>Upload of additional data kept in HTML form along with files.</li>
		</ul>
		<div class="note">
			<h4>Note</h4>
			<p>
				This demo application <strong>deletes all previously uploaded files</strong>.
				Keep in mind that it is a feature of this demo, not of Image Uploader itself. If
				you <strong>do not want to delete uploaded files</strong>, you should modify the
				upload processing page specified by the <strong>Action</strong> parameter.
			</p>
		</div>
	
	
		<p>
			Total source file size:
			<input id="TotalSourceFileSize" type="text" readonly="readonly"
				value="0" size="7" />
			kb
		</p>

		<script type="text/javascript">
//<![CDATA[	
//Create JavaScript object that will embed Image Uploader to the page.
var iu = new ImageUploaderWriter("ImageUploader1", 650, 400);

//For ActiveX control full path to CAB file (including file name) should be specified.
iu.activeXControlCodeBase = "../Scripts/ImageUploader6.cab";
iu.activeXControlVersion = "6,5,6,0";

//For Java applet only path to directory with JAR files should be specified (without file name).
iu.javaAppletJarFileName = "ImageUploader6.jar";
iu.javaAppletCodeBase = "../Scripts/";
iu.javaAppletCached = true;
iu.javaAppletVersion = "6.5.6.0";

iu.showNonemptyResponse = "off";

//Configure License Keys
iu.addParam("LicenseKey", "XXXXX-XXXXX-XXXXX-XXXXX-XXXXX;XXXXX-XXXXX-XXXXX-XXXXX-XXXXX");

//Configure appearance and behaviour.
iu.addParam("PaneLayout", "TwoPanes");
iu.addParam("ShowDebugWindow", "true");
iu.addParam("ShowDescriptions", "false");
iu.addParam("BackgroundColor", "#ffffff");

//Configure Image Uploader to rotate photos automatically 
//according to the orientation stored in EXIF metadata.
iu.addParam("AllowAutoRotate", "true");

//Configure file mask to upload JPEG images only.
iu.addParam("FileMask", "*.jpeg;*.jpg;*.jpe");

//Set image size restrictions.
iu.addParam("MinImageWidth", "360");
iu.addParam("MinImageHeight", "360");

//Exclude the source file from upload because only 
//resized versions of the photo will be sent.
iu.addParam("UploadSourceFile", "false");

//Configure settings of the optimized image. Optimized image
//is resized to 1200x1200 with JPEG quality = 60 and EXIF 
//metadata is preserved.
iu.addParam("UploadThumbnail1FitMode", "Fit");
iu.addParam("UploadThumbnail1Width", "1200");
iu.addParam("UploadThumbnail1Height", "1200");
iu.addParam("UploadThumbnail1JpegQuality", "60");
iu.addParam("UploadThumbnail1CopyExif", "true");

//Configure thumbnail settings.
iu.addParam("UploadThumbnail2FitMode", "Fit");
iu.addParam("UploadThumbnail2Width", "120");
iu.addParam("UploadThumbnail2Height", "120");
iu.addParam("UploadThumbnail2JpegQuality", "60");

//Configure URL files are uploaded to.
iu.addParam("Action", "upload.asp");

//Add event handlers.
iu.addEventListener("UploadFileCountChange", "ImageUploader1_UploadFileCountChange");
iu.addEventListener("Progress", "ImageUploader1_Progress");
iu.addEventListener("BeforeUpload", "ImageUploader1_BeforeUpload");

//Tell Image Uploader writer object to generate all necessary HTML code to embed 
//Image Uploader to the page.
iu.writeHtml();
//]]>
		</script>
	</form>
</body>
</html>
<!--END-->