We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. (Last updated on: June 24, 2019).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

AzureFileProvider.GetImage problem

Thread ID:

Created:

Updated:

Platform:

Replies:

148965 Nov 9,2019 02:10 PM UTC Nov 11,2019 12:52 PM UTC ASP.NET Core - EJ 2 2
loading
Tags: FileManager
bob ingham
Asked On November 9, 2019 02:10 PM UTC

I am working with theSyncfusion.EJ2.FileManager.AzureFileProvider.AspNet.Core solution with an angular front end. I seem to have full functionality working except for the get image in the AzureFileProvider:

public FileStreamResult GetImage(string path, string id, bool allowCompress, ImageSize size, params FileManagerDirectoryContent[] data)
{
return new FileStreamResult((new MemoryStream(new WebClient().DownloadData(this.FilesPath + path))), "APPLICATION/octet-stream");
}
All other methods are working with Blob Styorage. Why does this one look for files locally?

bob ingham
Replied On November 9, 2019 03:29 PM UTC

public FileStreamResult GetImage(string path, string id, bool allowCompress, ImageSize size, params FileManagerDirectoryContent[] data)
{
    CloudBlobDirectory sampleDirectory = container.GetDirectoryReference(path);
    CloudBlockBlob blob = container.GetBlockBlobReference(path);
    MemoryStream memoryStream = new MemoryStream();
    blob.DownloadToStreamAsync(memoryStream).GetAwaiter().GetResult();
    memoryStream.Seek(0, SeekOrigin.Begin);
    return new FileStreamResult(memoryStream, "APPLICATION/octet-stream");

    //return new FileStreamResult((new MemoryStream(new WebClient().DownloadData(this.FilesPath + path))), "APPLICATION/octet-stream");
}

I'm not sure what the parameters for id, allowCompress, size and data are used for.  But then again your method doesn't use them either.

Keerthana Rajendran [Syncfusion]
Replied On November 11, 2019 12:52 PM UTC

Hi Bob, 
 
Good day to you. 
 
We have checked your reported query on getImage issue for file manager component. This issue was caused due to framework limitations, since it will be working fine in .NET Core 2.1 and recent .NET Core3.0 versions. However, we have suggested the below work around solution for resolving this issue at your application level. For this, we have prepared a simple sample for getImage operation working state in .NET Core 2.2 version.  
 
        public IActionResult AzureGetImage(FileManagerImageContent args) 
        { 
 
            return this.operation.GetImage(args.Path, args.Id, false, null, null); 
        } 
        public class FileManagerImageContent 
        { 
            public string Path { get; set; } 
            public string Id { get; set; } 
            
        } 
 
For your reference, we have prepared a sample. 
 
 
 
 
Note: After running the service, refer the local host URL in file manager sample. 
 
Query 2 – Parameters. 
 
This parameter (id, allowCompress, data) used in base method, we have inherit the base method. For this reason, we have declared the parameter in getImage operations. 
 
Regards, 
Keerthana. 


CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

Live Chat Icon For mobile
Live Chat Icon