November Happy Hour will be moved to Thursday December 5th.
November Happy Hour will be moved to Thursday December 5th.
Is there a reason why you want it returned as a Unified File?
If you follow the code at the end of the post you will get a IVFileData object. You can try casting it to a Unified File object. Have not tried the cast myself. This coe will only work when using a ImageVaultImageProperty.
int imageVaultFileId = GetFileID(pageData, "imageVaultPropertyName");
if(id > 0)
{
IVFileData file = IVDataFactory.GetFile(imageVaultFileId, ImageStoreNET.Developer.Security.IVAccessLevel.IgnoreAccess);
}
private int GetFileID(PageData pd, string propertyName)
{
int id;
string[] ImageData = ((string)pd[propertyName]).Split(new Char[] { '~' });
string imgId = ImageData[1] ?? string.Empty;
int.TryParse(imgId, out id);
return id;
}
BR,
Tore
Hi!
ImageVault does not use Unified File System for storing images.
You can get a IVFileData object by using IVUrlBuilder.ParseUrl on the property like.
IVUrlBuilder ub = IVUrlBuilder.ParseUrl(CurrentPage["ImageVaultImage"] .ToString());
IVFileData file = IVDataFactory.GetFile(ub.Id);
Then you can use the IVFileData object to get more information about the file or use the IVUrlBuilder to get the URL to the image in the format you want.
BR /Johan, Product Manager Meridium
The reason I ask is because we are using an image resizing class library (DNAide) which expects the physical file path rather than a URL pointing to the file. DNaide will resize the image and do any transformations needed and save it to a cache folder on the server which is what is returned to the users' browsers. This allows us to put overlays onto images the client has uploaded.
At the moment I'm having to do the following to copy the image needed to another folder so I can then return the path to DNAide.
----------------------------------------------------------------
Bitmap retImage = null;
string retVal = "";
try
{
IVFileData fileData = IVDataFactory.GetFile(IVUrlBuilder.ParseUrl(imageLocation).Id);
HttpWebRequest request = (HttpWebRequest)WebRequest.Create(HttpContext.Current.Request.Url.Scheme + "://" + HttpContext.Current.Request.Url.Host + ":" + HttpContext.Current.Request.Url.Port + fileData.LinkURL);
request.Timeout = 5000;
request.ReadWriteTimeout = 20000;
HttpWebResponse response = (HttpWebResponse)request.GetResponse();
retImage = (Bitmap)Bitmap.FromStream(response.GetResponseStream());
retVal = HostingEnvironment.ApplicationPhysicalPath + @"\_Client\Images\ImageVault" + fileData.FileName;
retImage.Save(retVal);
retImage.Dispose();
}
catch (Exception)
{
}
return retVal;
----------------------------------------------------------------
Ideally I'd like to point DNAide to the image file that Image Vault points to - is this at all possible?
Hi,
I'm storing an image link for a page as an ImageVaultImage property. This gives me a link to a handler that'll return an image file.
Is there a way I can return this and read it in as a unified file?