Reputation: 3451
I have the following configured in my web.config:
<resizer>
<clientcache minutes="1440" />
<plugins>
</plugins>
<plugins>
<add name="AzureReader2"
connectionString="DefaultEndpointsProtocol=https;AccountName=myaccountname;AccountKey=myaccountkey="
endpoint="https://az824306.vo.msecnd.net/"
prefix="~/" />
</plugins>
</resizer>
I have a directory called bdgtpd
under the root of my website and in there I have one image 40420_1.png
.
I also have this image on azure located at:
https://az824306.vo.msecnd.net/bdgtpd/40420_1.png
Initially, I had my src set to https://az824306.vo.msecnd.net/bdgtpd/40420_1.png
, but when I tried to apply something like https://az824306.vo.msecnd.net/bdgtpd/40420_1.png?width=300
, it did not work.
So then I set it to:
<img src="~/bdgtpd/40420_1.png?width=300 />
and this does resize the image, but when I look in the chrome console, I can see it is grabbing the image from my local folder. Maybe I don't understand the AzureReader2 plugin, but I thought it when it sees:
http://localhost/bdgtpd/40420_1.png?width=300
, this would be fetch the image from https://az824306.vo.msecnd.net/bdgtpd/40420_1.png
and apply the transformation.
Am I setting my src
right? Should it be a local url or the cdn url?
Ok, so I deployed ImageResizer along with AzureReader2 to my staging server and I am pointing my images to my staging server. When I set the prefix to ~/
, the site threw 404 error and there were messages such as Blob Not Found
. All the images on the home page are in the CDN. When I make the prefix ~/azure/
, it works fine, so I am not sure what is going on here.
I was looking at the could architecture documentation, but I am confused on a couple things:
~/azure/
prefix path set, so when I look in the chrome console under the network tab, I see the initiator is my staging server path, but the image is actually being pull from the cdn. It would be great to have a simple explanation of what is happening.Thanks so much
Upvotes: 0
Views: 77
Reputation: 16468
If ImageResizer is running on localhost (for example), then your URLs should point to localhost. Azure doesn't have any magic ability to understand ImageResizer commands and execute them; you have to talk to the server with ImageResizer installed.
You should configure AzureReader2 with a prefix (like /azure/), although it appears you've discovered that this works?
Upvotes: 1