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. Image for the cookie policy date

AzureFileProvider.GetImage problem

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?

2 Replies

BI bob ingham 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.


KR Keerthana Rajendran Syncfusion Team 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. 


Loader.
Live Chat Icon For mobile
Up arrow icon