Rank: Advanced Member
Groups: Member, Administration, Moderator Joined: 8/3/2003(UTC) Posts: 1,070
Thanks: 1 times Was thanked: 12 time(s) in 12 post(s)
|
Hello, As far as I understand you want to change thumbnail size according to size of the original image. Unfortunately you cannot get any data related to image size from quality meter nevertheless you can get size of the original image client-side in the script. So the scenario will be the following: - You send each image in a single package
- Handle PackageBeforeUpload event
- Analyze image size there and change settings of a thumbnail.
Code:
//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 = "./ImageUploader5.cab";
iu.activeXControlVersion = "5,7,24,0";
//For Java applet only path to directory with JAR files should be specified (without file name).
iu.javaAppletJarFileName = "ImageUploader5.jar";
iu.javaAppletCodeBase = "./";
iu.javaAppletCached = true;
iu.javaAppletVersion = "5.7.24.0";
iu.showNonemptyResponse = "off";
//Configure appearance.
iu.addParam("PaneLayout", "TwoPanes");
iu.addParam("ShowDebugWindow", "true");
iu.addParam("AllowRotate", "false");
iu.addParam("BackgroundColor", "#ccccff");
//Configure thumbnail settings.
iu.addParam("UploadThumbnail1FitMode", "Fit");
iu.addParam("UploadThumbnail1JpegQuality", "60");
iu.addParam("FilesPerOnePackageCount", "1");
//Configure URL files are uploaded to.
iu.addParam("Action", "ExtractFiles.aspx");
iu.addEventListener("PackageBeforeUpload", "ImageUploader_PackageBeforeUpload");
iu.writeHtml();
function ImageUploader_PackageBeforeUpload(PackageIndex){
var width = getImageUploader("ImageUploader1").getUploadFileWidth(1);
var height = getImageUploader("ImageUploader1").getUploadFileHeight(1);
if (width > 500){
getImageUploader("ImageUploader1").setUploadThumbnail1Width(500);
getImageUploader("ImageUploader1").setUploadThumbnail1Height(350);
}
else{
getImageUploader("ImageUploader1").setUploadThumbnail1Width(350);
getImageUploader("ImageUploader1").setUploadThumbnail1Height(500);
}
}
Edited by user Thursday, February 26, 2009 7:02:12 PM(UTC)
| Reason: Not specified |
|