Connection Information for Azure Blob storage For ImageSharp

Vote:
 

Hello, we're working with the Optimizely.ImageSharp.Web Library on CMS 12, and it requires Azure Blob Storage connection information for DXP sites. Previously for the Windows based (CMS 11) clients the keys to pull from the Web.config were 'EPiServerAzureBlobs', and there was no blob container needed.  Does anyone know what the keys are for configuration in CMS 12 without a Web.config? 

Github Bug Report

Thanks!

#271304
Edited, Feb 07, 2022 15:40
Vote:
 

Hi,

You should be able to configure this in StartUp.cs, like the DXP-example shows here:

https://github.com/vnbaaij/Baaijte.Optimizely.ImageSharp.Web#configuration-for-use-with-dxp

Basically you specify connection yourself based on what you have configured in appSettings.json.

From appSettings.json:

"ConnectionStrings": {
        "EPiServerDB": "",
        "EcfSqlConnection": "",
        "EPiServerAzureBlobs": "",
        "EPiServerAzureEvents": ""
    }

In StartUp.cs

var blobConnection = _configuration.GetConnectionString("EPiServerAzureBlobs");
imageSharpBuilder.Configure<AzureBlobStorageCacheOptions>(options =>
                {
                    options.ConnectionString = blobConnection;
                    options.ContainerName = "resizer-cache";
                });

imageSharpBuilder.SetCache<AzureBlobStorageCache>();
#271458
Feb 10, 2022 7:35
Maxim Shishov - Feb 18, 2022 17:07
Hi Mari,

I can see classes AzureBlobStorageCacheOptions and AzureBlobStorageCache in your answer. I can't find these classes in my solution. It looks that I missed some package (or using a wrong version of the package). Could you please provide me with a full names these classes?

Thank you in advance.
- Feb 18, 2022 18:07
These classes are part of the ImageSharp library that this original questions refers to: https://github.com/vnbaaij/Baaijte.Optimizely.ImageSharp.Web
Package name: SixLabors.ImageSharp.Web.Providers.Azure
Maxim Shishov - Feb 21, 2022 12:06
Hi Mari,

Thank you! I added package "SixLabors.ImageSharp.Web.Providers.Azure" and it looks OK now.
Vote:
 

Thanks! The connection string worked perfectly, but I wasn't able to use 'resizer-cache' as it wasn't a valid container in my DXP environment? Using the default blob storage container name `mysitemedia` worked perfectly though. Thank you!

#272290
Feb 16, 2022 16:46
- Feb 18, 2022 11:17
Great to hear!

I am not familiar with DXP, but I assume you can ask hosting to create cache container for you?
Vote:
 

I have a recently deployed DXP site using Baaijte.Optimizely.ImageSharp.Web where I've setup the AzureBlobStorageCacheOptions as described, however I'm getting 404 errors on the images from the ImageSharp plugin.

I've also added AzureBlobStorageImageProviderOptions as noted in this SO post, but I still get 404 errors: https://stackoverflow.com/questions/69081515/imagesharp-web-with-azureblobstorageimageprovider-giving-404s

The connection strings are now stored using Microsoft KeyVault, is it possible to configure the blob storage when the connection string is in this format?

#284770
Aug 01, 2022 19:04
Vote:
 

@Cheryl did you migrate an existing site? Do you also get a 404 when uploading a new image? I've had a similar issue with 404's caused by storing the images in a different container than the default "mysitemedia". What worked for me was to configure the azure blob provider options in startup like so:

//put this after 'AddCmsCloudPlatformSupport'
services.Configure<AzureBlobProviderOptions>(o =>
{
    o.ContainerName = "mycontainer";
});

Note that most likely you cannot override the connection string this way.

#284806
Aug 02, 2022 1:09
Vote:
 

Hi @Ynze - This is a brand new site currently in development. We're having the issue with existing images that were added before the plugin was configured, and also newly uploaded images.

I am assuming the images are going to the default "mysitemedia" so I haven't explicitly set that in the configuration, but I can try to add that as a test.

#284821
Aug 02, 2022 15:30
Cheryl Kellas - Aug 11, 2022 15:35
I just got this working, it was a similar solution to this forum post: https://world.optimizely.com/forum/developer-forum/cms-12/thread-container/2022/3/image-resizing-for-optimizely-cms-12-doesnt-work/

In addition to adding the app.UseBaaijteOptimizelyImageSharp(); middleware early in the Configure() method, I also had to add services.AddBaaijteOptimizelyImageSharp(); *before* configuring the blob and caching provider options in the ConfigureServices() method.
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.