ImageProcessor Help Request


Hi Everyone,

I'm trying to take to take Vincent Baaij's ImageProcessor.Web.Episerver for a test drive, but I'm failing hard trying to get it to work. I've been trying for a couple of days now and I'm not sure what else to try.

The goal is to actually use the Azure version as we're running in DXC, but i've tried this and the local version in our codebase to no avail.

I had done little more than install the package and build to get:

Failed to load resource: the server responded with a status of 500 (Internal Server Error)

Not sure where to start or what info to provide here so I'll start with the exception being thrown:

Exception thrown: 'System.NullReferenceException' in ImageProcessor.Web.Episerver.Azure.dll

The stacktrace shows the following:

at ImageProcessor.Web.Episerver.Azure.AzureBlobCache..ctor(String requestPath, String fullPath, String querystring)

These are the packages I have installed:

<package id="ImageProcessor" version="" targetFramework="net461" />
<package id="ImageProcessor.Plugins.WebP" version="1.1.0" targetFramework="net461" />
<package id="ImageProcessor.Web" version="" targetFramework="net461" />
<package id="ImageProcessor.Web.Config" version="" targetFramework="net461" />
<package id="ImageProcessor.Web.Episerver" version="" targetFramework="net461" />
<package id="ImageProcessor.Web.Episerver.Azure" version="" targetFramework="net461" />

The web.config seems to have the all the entries it needs (pointers to the config files, imageprocessormodule etc).

I can successfully use something like:

PictureUtils.GetPictureData(Url.ContentUrl(Model.Image), ImageTypes.HeroImage, true);

to return a url like:


but any image I attempt to GET that has the query string appended to it results in a 500 error. Remove the ?... and the image is retrieved correctly.

Any thoughts as to where to start?


Dec 21, 2018 11:50

Hi Alex,

Did you install ImageProcessor module for Azure version in your local machine, right? So did you config blob storage provider and connection string for the default blob provider? You can see what needed configuration for Azure cache in this current git source for image processor package

 public AzureBlobCache(string requestPath, string fullPath, string querystring)
            : base(requestPath, fullPath, querystring)
            // Get the name of the configured blob provider
            string providerName = EPiServerFrameworkSection.Instance.Blob.DefaultProvider;

            if (rootContainer == null)
                // Get the name of the connection string from there
                string connectionStringName = EPiServerFrameworkSection.Instance.Blob.Providers[providerName].Parameters["connectionStringName"];

                // Retrieve storage account from connection string.
                CloudStorageAccount cloudCachedStorageAccount = CloudStorageAccount.Parse(ConfigurationManager.ConnectionStrings[connectionStringName].ConnectionString);
                // Create the blob client.
                CloudBlobClient cloudBlobClient = cloudCachedStorageAccount.CreateCloudBlobClient();

                // Retrieve reference to the container. Container is already created as part of the initialization process for the BlobProvider
                rootContainer = cloudBlobClient.GetContainerReference(EPiServerFrameworkSection.Instance.Blob.Providers[providerName].Parameters["container"]);

            //cachedCdnRoot = Settings.ContainsKey("CachedCDNRoot")
            //                         ? Settings["CachedCDNRoot"]
            //                         : rootContainer.Uri.ToString().TrimEnd(rootContainer.Name.ToCharArray());

            if (Settings.ContainsKey("CDNTimeout"))
                int.TryParse(Settings["CDNTimeout"], out int t);
                timeout = t;

            // This setting was added to facilitate streaming of the blob resource directly instead of a redirect. This is beneficial for CDN purposes
            // but caution should be taken if not used with a CDN as it will add quite a bit of overhead to the site.
            // See:
            streamCachedImage = Settings.ContainsKey("StreamCachedImage") && Settings["StreamCachedImage"].ToLower() == "true";
Edited, Dec 24, 2018 3:50

Hi Alex,

Did you get any further with this? If not, let me know. I'm pretty sure we can get to a working situation.

Jan 08, 2019 9:26

This code doesn't work..Will be obliged if u provide further code than this too.Regards

Edited, Apr 19, 2019 13:56

Hi Vincent,

I didn't get any further unfortunately. I played around with Binh's code but couldn't get that working either. 

Any advice?

Thanks :) 

Mar 01, 2019 10:10