ImageResizer for Azure using AzureReader2 plugin not resizing
Asked Answered
O

2

3

EDIT

I got it to work however I had to add the RemoteReader plugin. When I remove the AzureReader2 plugin from my project it still works which makes sense however what is the AzureReader2 plugin benefiting me?

ORIGINAL QUESTION

I have done everything that has been outline here (including the comments) but can't seem to figure out why I can't resize images on the fly with this plugin for imageresizer.

This is what my web.config entry under the element looks like:

<add name="AzureReader2" prefix="~/img/" connectionString="DefaultEndpointsProtocol=https;AccountName=[Account];AccountKey=[key]" endpoint="http://<account>.blob.core.windows.net/" />

and I have set up my container to be called 'img'.

When I go to this URL to test it out: https://<account>.blob.core.windows.net/img/image.jpg?width=50 The image shows up but just in its regular size. I've also tried running this locally and on the live side AWS but still get no resizing :(

Oyster answered 3/2, 2013 at 17:26 Comment(0)
P
5

ImageResizer library allows to serve modified versions of images (resized, cropped, rotated, with watermark etc.). AzureReader2 is a plugin that allows to fetch unmodified images from the Azure Blob (https://<account>.blob.core.windows.net) as opposed to disk.

So URL which should be used to obtain modified version of an image is your application URL with ImageResizer library installed and not Azure Blob URL (in your example https://<account>.blob.core.windows.net/img/image.jpg?width=50).

EDIT

AzureReader2 plugin allows you to read images from Azure Blob the same way as if they were saved in a disk. If you application is built in a way that all images are coming from Azure Blob, you can have two independent teams: one managing your images (and other media like CSS) and one managing your code. With that approach AzureReader2 plugin will be very handy.

I hope that will help.

Pavlish answered 3/2, 2013 at 18:58 Comment(3)
when I go to https://<account>.blob.core.windows.net/img/image.jpg?width=50 it doesn't give me the resized image.. I have to use http://<account>.azurewebsites.net/remote/<account>.blob.core.windows.net/img/image.jpg?width=50 to get it to work :(Oyster
So I guess the question is, what URL do I use for the AzureReader2 plugin and not the RemoteReader plugin?Oyster
I haven't used AzureReader2 before, and configuration parameters do not provide any example. Did you use prefix parameter of that plugin?Pavlish
O
3

After hours of playing around I finally understand how it works. I didn't realize the prefix is what you tack on the end of the actual URL and not the BLOB store URL. I ended up with

http://<account>.azurewebsites.net/img/img/image.jpg?width=50

This worked instead of my original thinking of:

https://<account>.blob.core.windows.net/img/image.jpg?width=50

For anybody that's looking at this the prefix is whats tacked on the URL of the actual site and not the BLOB store!

Oyster answered 3/2, 2013 at 19:30 Comment(3)
Well it kind of makes sense since the request has to be routed through the http module in order for the 'magic' to occur. If you reference the blob store how is the module going to intercept the request?Uri
@Oyster Sorry what did you do differently?Chappy
@John - I just used the first URL instead of the 2nd one.Oyster

© 2022 - 2024 — McMap. All rights reserved.