Get stream to file in ImageVault 3.

Vote:
 

We are currently working on a project which uses ImageVault 3.5 and we need to get a stream or byte array of several files. Does anyone know how to do this? IVFileData.OpenRead() doesn't seem to work. When looking at this class with a decompiler we see the following code.

public Stream OpenRead()
{
    throw new ApplicationException("ImageVault does not support read with Unified File System");
}

 

Thanks in advance!

#75679
Oct 03, 2013 15:59
Vote:
 

This is not possible using the public API, But the following blog post shows how you can get access to the file on disk.

http://www.meridium.se/sv/blogg/2010/05/14/width-and-height-of-an-image/

/Johan

#75744
Oct 04, 2013 14:03
Vote:
 

Hi Johan,

Thanks for your reply, we used the FileWrapper instance as shown in the blog post.
This object contains a public File field which is an instance of FileInfo which contains the correct path to the physical file on disk.
We used FileInfo.OpenRead() to get the stream.

Thanks!

Best Regards,

Robert.

#75745
Oct 04, 2013 14:07
Vote:
 

Hi Johan,

How would we do this in ImageVault 4.7?
Thanks in advance!

Regards,

Robert.

#122466
Jun 03, 2015 9:36
Vote:
 

In ImageVault 4 there is a backend service that is responsible for storage, conversion etc. This service might be located on another machine and the actual storage of files is handled by a plugable storage provider which might not use the filesystem. Hence you can not get access to the actual file from the client.
You will have to rely on getting the media file using the URL provided by the API.

Though if you need access to the actual files you can write your own storage module for this using the IMediaStorage interface.

If you could describe the problem you want to solve we might be able to provide an alternative solution.

/Johan

#122481
Jun 03, 2015 12:11
Vote:
 

Hi Johan,

Thanks, that is what I'm experimenting with at the moment, grabbing the file(s) by their URLs.
We're trying to create a zip file from a subset of imagevault files which people can select on the front-end side.
I've seen some methods on service interfaces in the ImageVault API documentation which (according to their name) seem to create zip files, but I'm not really sure on how to use them and if the zip files are stored on the ImageVault backend.

Regards,

Robert.

#122483
Jun 03, 2015 12:18
Vote:
 

You should be able to use the function in MediaContentService to create a zip file.

http://imagevault.se/DeveloperDocumentation/Reference/html/M_ImageVault_Common_Services_IMediaContentService_CreateZipArchive.htm

See this example on how to call the services directly.

http://imagevault.se/en/documentation/api-documentation/?page=csharp/services.html

/Johan

#122488
Jun 03, 2015 12:29
Vote:
 

If I would like to get/zip the original format for the collection of files, what would I pass as 'mediaFormatId' parameter in the CreateZipArchive method? And how would I use the returned string?

Regards,

Robert.

#122498
Edited, Jun 03, 2015 14:01
Vote:
 

Try something like this

var mediaContentService = client.CreateChannel<IMediaContentService >();
var key = mediaContentService.CreateZipArchive( new [] {2520,2519,2491} , 1);
var url = new Uri(new Uri(ClientConfigurationSection.Instance.ImageVaultCore.CurrentAddress), "MediaStreamService/Archive/" + key + "/package.zip?download=1");

/Johan

#122510
Jun 03, 2015 15:38
Vote:
 

That works like a charm. But it leaves a file on the server though. Is there anyway to configure imagevault so that these are cleaned up in some sort of way. Or should we implement some sort of garbage collection on our own?

Thanks!

Regards,

Robert.

#122512
Jun 03, 2015 15:53
Vote:
 

The CleanUpJob should remove files older than 24 hours.

/Johan

#122514
Jun 03, 2015 16:15
Vote:
 

Great! Thanks a lot for your time and help!

Robert.

#122515
Edited, Jun 03, 2015 16:18
This topic was created over six months ago and has been resolved. If you have a similar question, please create a new topic and refer to this one.
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.