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

Notification

Icon
Error

Options
Go to last post Go to first unread
mixersoft  
#1 Posted : Monday, September 25, 2006 11:13:42 AM(UTC)
mixersoft

Rank: Member

Groups: Administration
Joined: 9/25/2006(UTC)
Posts: 10

Hi,

I need to do the following for my app: 1) filter a folder of images ( selected by the user and on the client file system) based on EXIF values, and then 2) pre-select a list of images to upload?

Can I do that easily using the api/hooks provided by Image Uploader? I'm particularly interested in understanding what level of access I have to the client file system through Image Uploader API

TIA

Eugene Kosmin  
#2 Posted : Monday, September 25, 2006 1:55:04 PM(UTC)
Eugene Kosmin

Rank: Advanced Member

Groups: Member, Administration, Moderator
Joined: 9/19/2006(UTC)
Posts: 505

Was thanked: 41 time(s) in 41 post(s)
Hello,

1. No, you can’t filter images by EXIF values on client side, but you can use ExtractExif property to do it on server side.

2. Because of security reasons Image Uploader doesn’t provide such API.

Edited by user Monday, February 25, 2008 6:24:32 PM(UTC)  | Reason: Not specified

Best regards,

Eugene Kosmin

The Aurigma Development Team

mixersoft  
#3 Posted : Tuesday, September 26, 2006 8:46:18 AM(UTC)
mixersoft

Rank: Member

Groups: Administration
Joined: 9/25/2006(UTC)
Posts: 10

Quote:
Jin (9/25/2006)

Hello,

1. No, you can’t filter images by EXIF values on client side, but you can use ExtractExif property to do it on server side.

2. Because of security reasons Image Uploader doesn’t provide such API.

WRT#2, I was looking through the api reference and found this:

Quote:
Get/Set Value in Runtime

JavaScript CopyCode imageCopy Code

value = getImageUploader("ImageUploaderD").getUploadFileName(Index);

Parameters

Index

A positive integer which specifies an index of the upload list item (i.e. the upload file). An index is 1-based. In other words valid value is in range [1, UploadFileCount].

Property Value

A string value that returns a file name of the specified upload list item.

If I had a list of files I wanted to pre-select, could I just use setUploadFileName? I can't tell if there is a set-ter for this funciton.

TIA

Edited by user Monday, February 25, 2008 6:26:38 PM(UTC)  | Reason: Not specified

mixersoft  
#4 Posted : Tuesday, September 26, 2006 9:15:46 AM(UTC)
mixersoft

Rank: Member

Groups: Administration
Joined: 9/25/2006(UTC)
Posts: 10

nevermind. I checked a few other functions and now understand the documention convention. there is no setter.

However, is this a possible workaround to pre-select a list of upload files?

1) have the user select an entire folder, so the upload list includes all files in the folder

2) use ExtractExif to send EXIF data along with the upload list,

3) on the server side, filter the upload list WITHOUT uploading

4) return the filter results to client via some sort of asynch method, and

5) go back to the upload list, and deselect the appropriate files using getImageUploader("ImageUploaderID").setUploadFileSelected(Index, value).

TIA

Eugene Kosmin  
#5 Posted : Tuesday, September 26, 2006 2:08:29 PM(UTC)
Eugene Kosmin

Rank: Advanced Member

Groups: Member, Administration, Moderator
Joined: 9/19/2006(UTC)
Posts: 505

Was thanked: 41 time(s) in 41 post(s)
Yes, there is workaround. First upload will send a list of files with Exif data and second will send filtered images.

Sending file list:

1. Copy Exif data to thumbnail UploadThumbnail1CopyExif property.

2. Disable source file sending UploadSourceFile property

3. We shouldn't delete items from upload pane after upload, so we set UncheckUploadedFiles to false.

4. Send

Sending filtered images:

1. After sending "upload list" with exif data we can get response from server in Progress event. In it's handler some elements from upload pane can be removed through UploadFileRemove

2. Allowing to send source files and undo another actions from Sending file list

3. Send through Send method

Here is pseudocode:

Code:
var WasUpload = false;

function ImageUploader_Progress(Status, Progress, ValueMax, Value, StatusText)
{
    if (Status=="COMPLETE")
	{
	   if (WasUpload)
	   {
		return;
	   }
	   // StatusText contains Response from server.

	   // Delete "bad" files from upload list
	   //document.getElementById("ImageUploader").UploadFileRemove(<BadImageIndex>);

	   // During next upload source files will be sent
	   document.getElementById("ImageUploader").UploadSourceFile = true;
	   document.getElementById("ImageUploader").UncheckUploadedFiles = true;
	   document.getElementById("ImageUploader").UploadThumbnail1FitMode = "Off";
	   WasUpload = true;
	   document.getElementById("ImageUploader").Send();
	   document.getElementById("ImageUploader").MessageUploadCompleteText = "Upload complete";
	}
} 
...
iu.addEventListener("Progress", "ImageUploader_Progress");
...
iu.addParam("UploadThumbnail1FitMode", "Icon");
iu.addParam("UploadThumbnail1CopyExif", true);
...
iu.addParam("ExtractExif", "ExifApertureValue;ExifArtist;ExifColorSpace;ExifGpsAltitude;ExifGpsLatitude;ExifSoftware");
iu.addParam("ExtractIptc", "IptcSource;IptcByline;IptcCopyrightNotice;IptcWriter;IptcUrgency");
...
iu.addParam("UploadSourceFile", "false");
iu.addParam("UncheckUploadedFiles", "false");
iu.addParam("MessageUploadCompleteText", "");

Edited by user Monday, February 25, 2008 5:55:15 PM(UTC)  | Reason: Not specified

Best regards,

Eugene Kosmin

The Aurigma Development Team

mixersoft  
#6 Posted : Thursday, September 28, 2006 11:57:29 PM(UTC)
mixersoft

Rank: Member

Groups: Administration
Joined: 9/25/2006(UTC)
Posts: 10

Hi,

I'm testing out the method you outlined, but I'm running into a slight problem. I can manually implement the 2 phase upload you described, but I can't do it automatically.

I see, to be having problems with these 2 methods:

iu.addParam("UncheckUploadedFiles", "false");

iu.Send();

after the first step of the upload, the upload list is always reset, so there is nothing to remove from the upload list.

Am I doing something wrong? Here's my script:

Code:
//<![CDATA[
//Create JavaScript object that will embed Image Uploader to the page.
var iu = new ImageUploaderWriter("ImageUploader1", 550, 490);

//For ActiveX control full path to CAB file (including file name) should be specified.
iu.activeXControlCodeBase = "javascripts/ImageUploader4.cab";
iu.activeXControlVersion = sc.activeXControlVersion;

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

iu.showNonemptyResponse = "off";

//Configure appearance and behaviour.
iu.addParam("PaneLayout", "TwoPanes");
//iu.addParam("FolderView", "Thumbnails");
iu.addParam("FolderView", "Details");
iu.addParam("UploadView", "Details");
iu.addParam("PreviewThumbnailSize", "100");
iu.addParam("ShowButtons", "false");
iu.addParam("ShowSubfolders", "true");
iu.addParam("ShowDescriptions", "false");
iu.addParam("ShowContextMenu", "false");
iu.addParam("ShowDebugWindow", "true");
iu.addParam("AllowMultipleRotate", "true");

//Configure colors.
iu.addParam("PaneBackgroundColor", "#ffffff");
iu.addParam("BackgroundColor", "#ffffff");
iu.addParam("PreviewThumbnailActiveColor", "#f8b330");
iu.addParam("PreviewThumbnailInactiveColor", "#eeeeee");

//Hide tree pane.
iu.addParam("TreePaneWidth", "-1");

//Allow upload not only files, but also entire folders.
//iu.addParam("AllowFolderUpload", "true");

//Single or multiple file selection.
//iu.addParam("AllowMultipleSelection", "false");

//Link ImageUploader with ShellComboBox.
iu.addParam("AdditionalFolderNavigator", "ImageUploader");

//Configure file mask to display images only.
iu.addParam("FileMask", "*.jpg;*.jpeg;*.jpe;*.gif;*.png;*.tif;*.tiff;*.psd");

//Configure thumbnail settings.
iu.addParam("UploadThumbnail1Width", "60");
iu.addParam("UploadThumbnail1Height", "60");
iu.addParam("UploadThumbnail1JpegQuality", "60");
//iu.addParam("UploadThumbnail1CopyExif", "true");

//Configure upload settings.
iu.addParam("Action", "upload");
iu.addParam("FilesPerOnePackageCount", "10");
iu.addParam("AutoRecoverMaxTriesCount", "2");
iu.addParam("AutoRecoverTimeOut", "10000");

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

//Append the form with total file size to the upload.  
iu.addParam("AdditionalFormName", "Form1");

//2 phase upload Prepare
iu.addParam("UploadThumbnail1FitMode", "fit");
iu.addParam("UploadThumbnail1CopyExif", "true");
iu.addParam("AllowFolderUpload", "true");
iu.addParam("UploadSourceFile", "false");
iu.addParam("UncheckUploadedFiles", "false");


//Add event handlers.
iu.addEventListener("UploadFileCountChange", "ImageUploader_UploadFileCountChange");
iu.addEventListener("Progress", "ImageUploader_Progress");
iu.fullPageLoadListenerName = "FullPageLoad";

//Tell Image Uploader writer object to generate all necessary HTML code to embed 
//Image Uploader to the page.
iu.writeHtml();
//]]>
				</script>
	<script type="text/javascript">
//<![CDATA[	
//This UploadFileCountChange event handler displays total size of all files selected for upload.
function ImageUploader_UploadFileCountChange(){
	var imageUploader1 = getImageUploader("ImageUploader1");
	if (imageUploader1){
		document.getElementById("TotalSourceFileSize").value = Math.ceil(imageUploader1.getTotalFileSize() / 1024);
	}
}

//This Progress event handler demonstrates an alternative way to 
//redirect upon upload (instead of RedirectUrl property).
var WasUpload = false;
function ImageUploader_Progress(Status, Progress, ValueMax, Value, StatusText)
{
    if (Status=="COMPLETE")
	{
	   if (WasUpload)
	   {
		WasUpload = false;
		window.location = 'gallery'; 
		return;
	   }
	   // StatusText contains Response from server.

	   // Remove unwanted files from upload list

        var iu = getImageUploader("ImageUploader1");
//if (iu) {alert('start remove mode');}
//        var n;
//        var removeList = new Array(1,2);
//        for (n in removeList)
//        {
//          alert(' remove ' + removeList[n] + '');
//          iu.UploadFileRemove(removeList[n]);
//        } 

alert('preparing for source upload');	
	   // During next upload source files will be sent
	   iu.UploadSourceFile = true;
	   iu.UncheckUploadedFiles = true;
	   iu.UploadThumbnail1FitMode = "Fit";
	   WasUpload = true;
alert('finished preparing for source upload');	   
	   iu.Send();
	   iu.MessageUploadCompleteText = "Source Upload complete";
	} 
} 
//]]>

Edited by user Tuesday, February 19, 2008 2:50:23 PM(UTC)  | Reason: Not specified

mixersoft  
#7 Posted : Friday, September 29, 2006 9:37:08 AM(UTC)
mixersoft

Rank: Member

Groups: Administration
Joined: 9/25/2006(UTC)
Posts: 10

UPDATE: This above seems to work in the java version, but not ActiveX.
mixersoft  
#8 Posted : Saturday, September 30, 2006 10:47:18 PM(UTC)
mixersoft

Rank: Member

Groups: Administration
Joined: 9/25/2006(UTC)
Posts: 10

ANOTHER UPDATE: Java version fails on 'iu.UncheckUploadedFiles = false;' and 'iu.UploadFileRemove(n);'
Eugene Kosmin  
#9 Posted : Monday, October 2, 2006 4:44:54 PM(UTC)
Eugene Kosmin

Rank: Advanced Member

Groups: Member, Administration, Moderator
Joined: 9/19/2006(UTC)
Posts: 505

Was thanked: 41 time(s) in 41 post(s)
Hello,

sorry for delay.

We found a bug with UncheckUploadedFiles property and it will be fixed in the nearest release. In Java version try to use

Code:
iu.setUncheckUploadedFiles(false)
instead of
Code:
 iu.UncheckUploadedFiles = false 

Edited by user Tuesday, February 19, 2008 2:50:07 PM(UTC)  | Reason: Not specified

Best regards,

Eugene Kosmin

The Aurigma Development Team

mixersoft  
#10 Posted : Tuesday, October 10, 2006 2:44:43 PM(UTC)
mixersoft

Rank: Member

Groups: Administration
Joined: 9/25/2006(UTC)
Posts: 10

Quote:

We found a bug with UncheckUploadedFiles property and it will be fixed in the nearest release. In Java version try to use

Code:
iu.setUncheckUploadedFiles(false)
instead of
Code:
 iu.UncheckUploadedFiles = false 

Hi, I had already made the changes you mentioned, but I'm still having some problems. But what about the corresponding addParam call, does that need to be changed?

Code:
iu.addParam("UncheckUploadedFiles", "false");

Edited by user Tuesday, February 19, 2008 2:49:32 PM(UTC)  | Reason: Not specified

Eugene Kosmin  
#11 Posted : Tuesday, October 10, 2006 6:23:33 PM(UTC)
Eugene Kosmin

Rank: Advanced Member

Groups: Member, Administration, Moderator
Joined: 9/19/2006(UTC)
Posts: 505

Was thanked: 41 time(s) in 41 post(s)
Hi,
Code:
iu.addParam("UncheckUploadedFiles", "false");
doesn't need to be change, but you can try to replace
Code:
document.getElementById("ImageUploader").Send();
with
Code:
setTimeout("getImageUploader('ImageUploader1').Send()", 500);
I sent you private message with URLs to new builds.

Edited by user Tuesday, February 19, 2008 2:48:30 PM(UTC)  | Reason: Not specified

Best regards,

Eugene Kosmin

The Aurigma Development Team

Users browsing this topic
Guest
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.