Welcome Guest! You need to login or register to make posts.

Notification

Icon
Error

Options
Go to last post Go to first unread
Tamila  
#1 Posted : Sunday, March 29, 2009 7:56:50 PM(UTC)
Tamila

Rank: Advanced Member

Groups:
Joined: 3/9/2008(UTC)
Posts: 554

Was thanked: 1 time(s) in 1 post(s)
Image Uploader has an opportunity to set the number of thumbnails dynamically without page reloading after successful upload process.

For example, you have two radio buttons to set quality (low or high) of uploaded pictures. Let us say for "high" quality you generate two thumbnails and source file, for "low" quality you generate three thumbnails.

In the first time you have uploaded pictures with "low" quality. Now you want to upload pictures with "high" quality. So, if you switch over "low"quality to "high" you should disable the third thumbnail. In this case you should set two properties:

Code:
iu.setUploadThumbnail3FitMode("Off");
iu.setUploadThumbnail3CompressionMode("*.*=Jpeg");

The following code demonstrates how to realize this example:

Code:
var iu1 = new ImageUploaderWriter("ImageUploader1", 750, 600);
//other params

iu1.addEventListener("BeforeUpload", "ImageUploader_BeforeUpload")

//other params

//Tell Image Uploader writer object to generate all necessary HTML code to embed 
//Image Uploader to the page.
iu1.writeHtml();

function ImageUploader_BeforeUpload()
{
	var iu = getImageUploader("ImageUploader1");
	var a = document.getElementsByName("quality");
	var checkedItem;
	for (var i=0; i< a.length; i++)
	{
		if(a[i].checked)
		{
			checkedItem=a[i];
			break;
		}
	}
	
	switch(checkedItem.value)
    {
		case "low":
			iu.setUploadSourceFile("false");
			
			iu.setUploadThumbnail1FitMode("Fit");
			iu.setUploadThumbnail1Width("500");
			iu.setUploadThumbnail1Height("500");
			iu.setUploadThumbnail1ResizeQuality("Medium");
			iu.setUploadThumbnail1JpegQuality("100");
			iu.setUploadThumbnail1CompressionMode("*.*=Jpeg,SourceFile");

			iu.setUploadThumbnail2FitMode("Fit");
			iu.setUploadThumbnail2Width("120");
			iu.setUploadThumbnail2Height("120");
			iu.setUploadThumbnail2ResizeQuality("High");
			iu.setUploadThumbnail2JpegQuality("100");
			iu.setUploadThumbnail2CompressionMode("*.*=Jpeg,SourceFile");
			
			iu.setUploadThumbnail3FitMode("Fit");
			iu.setUploadThumbnail3Width("2003");
			iu.setUploadThumbnail3Height("2003");
			iu.setUploadThumbnail3ResizeQuality("Medium");
			iu.setUploadThumbnail3JpegQuality("80");
			iu.setUploadThumbnail3CompressionMode("*.*=Jpeg,SourceFile");
			iu.setUploadThumbnail3CopyExif("True");

		break;
		default:    
		case "high":
			iu.setUploadSourceFile("true");
			
			iu.setUploadThumbnail1FitMode("Fit");
			iu.setUploadThumbnail1Width("500");
			iu.setUploadThumbnail1Height("500");
			iu.setUploadThumbnail1ResizeQuality("Medium");
			iu.setUploadThumbnail1JpegQuality("100");
			iu.setUploadThumbnail1CompressionMode("*.*=Jpeg,SourceFile");

			iu.setUploadThumbnail2FitMode("Fit");
			iu.setUploadThumbnail2Width("120");
			iu.setUploadThumbnail2Height("120");
			iu.setUploadThumbnail2ResizeQuality("High");
			iu.setUploadThumbnail2JpegQuality("100");
			iu.setUploadThumbnail2CompressionMode("*.*=Jpeg,SourceFile");
			
			iu.setUploadThumbnail3FitMode("Off");
			iu.setUploadThumbnail3CompressionMode("*.*=Jpeg");
		break;
	}
}

</script>

<form name="form1">
<p><input type="radio" name="quality" value="low">Low</p>
<p><input type="radio" name="quality" value="high" checked>High</p>
</form>

See also:

Aurigma Support Team

UserPostedImage Follow Aurigma on Twitter!

Users browsing this topic
Forum Jump  
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.