Upload image from URL does not work with Azure Blob url

Questions, comments and suggestions concerning VintaSoft Imaging .NET SDK.

Moderator: Alex

Post Reply
jwalit.katira
Posts: 31
Joined: Mon Sep 18, 2023 1:41 pm

Upload image from URL does not work with Azure Blob url

Post by jwalit.katira »

Hello,

Upload image from URL does not work with Azure Blob directly

For example :

https://res.cloudinary.com/demo/image/u ... sample.jpg

Above image url directly works but i put same image in blob and then use blob url (as below) it does not work

https://advblobimagestorage.blob.core.w ... plejpg.jpg

Passing azure blob URL Show error " "Accept-Ranges" mode is not supported for this URL. "

Can you please help me to under stand

Thanks
Jwalit Katira
Alex
Site Admin
Posts: 2319
Joined: Thu Jul 10, 2008 2:21 pm

Re: Upload image from URL does not work with Azure Blob url

Post by Alex »

Hello Jwalit,

"Upload image from URL" functionality uses byte-range requests to get the file data, i.e. web service uses lazy loading of file bytes and web service does not download the whole file to a web server.

If server does not support byte-range requests, web service needs to download the whole file to a web server and work with file on server.

Why do you use Azure Blob instead of direct URL? Do you want to prevent saving of JPEG file on client computer?

Best regards, Alexander
jwalit.katira
Posts: 31
Joined: Mon Sep 18, 2023 1:41 pm

Re: Upload image from URL does not work with Azure Blob url

Post by jwalit.katira »

Hello Alex,

As our images are saved in azure blob storage we want to directly use them without saving in backend and Yes we want to prevent saving of JPEG file on client computer, can you show how to achieve this.

Also After we made some property changes in Azure portal we are now not getting error of " "Accept-Ranges" mode is not supported for this URL. " " and image is rendering . But we still see that image is taking to much time to render , you can check with below URL

Code: Select all

https://advblobimagestorage.blob.core.windows.net/images/0.jpg
Thanks
Jwalit Katira
Alex
Site Admin
Posts: 2319
Joined: Thu Jul 10, 2008 2:21 pm

Re: Upload image from URL does not work with Azure Blob url

Post by Alex »

Hello Jwalit,

Thank you for information. JPEG image from URL is rendering during long time because web service sends many requests (200+) to the URL. We increased the buffer size in HTTP streaming stream and now web service sends only 1 request for each image tile. Now image from your URL is rendered in 1-2 seconds (time depends from connection speed between your server and URL server). Improved algorithm will be available in version 12.3.3.1 at the middle of January 2024.

Best regards, Alexander
jwalit.katira
Posts: 31
Joined: Mon Sep 18, 2023 1:41 pm

Re: Upload image from URL does not work with Azure Blob url

Post by jwalit.katira »

Hello Alex,

Thanks for the update , we will be looking forward for the version release.

Also can you please suggest if we want to directly work with byte array of file and not the file stream as response of .Net core API , As we do not want to save file in file server , How can it be achieved

Thanks
Jwalit Katira
Alex
Site Admin
Posts: 2319
Joined: Thu Jul 10, 2008 2:21 pm

Re: Upload image from URL does not work with Azure Blob url

Post by Alex »

Hello Jwalit,

Binary data can be sent only as a part of form data.

HTTP REST API does not allow to send binary data directly, i.e. binary data must be encoded to a base64-string.

VintaSoft Web Document Viewer can work base64-images.

Best regards, Alexander
jwalit.katira
Posts: 31
Joined: Mon Sep 18, 2023 1:41 pm

Re: Upload image from URL does not work with Azure Blob url

Post by jwalit.katira »

Hello Alex,

We checked with CreateSessionDataStorage for send base64string as response of GetItemCopy method (ref : https://www.vintasoft.com/docs/vsimagin ... abase.html)

but we are getting below error :

Code: Select all

{
    "files": null,
    "success": false,
    "blocked": false,
    "errorMessage": "Unable to cast object of type 'System.String' to type 'System.IO.Stream'.\r\n",
    "requestId": null
}
so this mean method should only response as file stream object So I cannot response base64 string of my block URL

Please share the input

Thanks
Jwalit Katira
Alex
Site Admin
Posts: 2319
Joined: Thu Jul 10, 2008 2:21 pm

Re: Upload image from URL does not work with Azure Blob url

Post by Alex »

Hello Jwalit,

Data storage can store data of any type.

You are using example that demonstrates how to create data storage based on streams:

Code: Select all

...
public bool CanStore(Type type)
{
    // specify that data storage can work only with images, which are stored in Stream objects

    if (typeof(Stream).IsAssignableFrom(type))
        return true;
    else
        return false;
}
...
If you want to create custom data storage, please do this - architecture is open.

Best regards, Alexander
Alex
Site Admin
Posts: 2319
Joined: Thu Jul 10, 2008 2:21 pm

Re: Upload image from URL does not work with Azure Blob url

Post by Alex »

Hello Jwalit,

In version 12.3.3.1 we have increased the image rendering performance in web image viewer when image is loading from URL. Please try to use version 12.3.3.1 and let me know if you will have any question or problem.

Best regards, Alexander
Post Reply