ImageResizer for Azure using AzureReader2 plugin not resizing

天大地大妈咪最大 提交于 2019-12-19 09:56:29

问题


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 :(


回答1:


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.




回答2:


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!



来源:https://stackoverflow.com/questions/14675118/imageresizer-for-azure-using-azurereader2-plugin-not-resizing

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!