简体   繁体   English

使用AzureReader2插件的Azure的ImageResizer不能调整大小

[英]ImageResizer for Azure using AzureReader2 plugin not resizing

EDIT 编辑

I got it to work however I had to add the RemoteReader plugin. 我可以使用它,但是必须添加RemoteReader插件。 When I remove the AzureReader2 plugin from my project it still works which makes sense however what is the AzureReader2 plugin benefiting me? 当我从项目中删除AzureReader2插件时,它仍然可以工作,这很有意义,但是AzureReader2插件对我有什么好处?

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. 我已经完成了此处概述的所有操作(包括注释),但似乎无法弄清楚为什么我不能使用此用于imageresizer的插件即时调整图像大小。

This is what my web.config entry under the element looks like: 这是我在元素下的web.config条目的样子:

<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'. 并且我将我的容器设置为“ 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. 当我转到该URL进行测试时,请执行以下操作: https://<account>.blob.core.windows.net/img/image.jpg?width=50图像显示出来,但只是其正常大小。 I've also tried running this locally and on the live side AWS but still get no resizing :( 我也尝试在本地和实时AWS上运行此命令,但仍然无法调整大小:(

ImageResizer library allows to serve modified versions of images (resized, cropped, rotated, with watermark etc.). ImageResizer库允许提供图像的修改版本(调整大小,裁剪,旋转,带有水印等)。 AzureReader2 is a plugin that allows to fetch unmodified images from the Azure Blob ( https://<account>.blob.core.windows.net ) as opposed to disk. AzureReader2是一个插件,允许从Azure Blob( https://<account>.blob.core.windows.net )而不是磁盘中获取未修改的图像。

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 ). 因此,用于获取图像修改版本的URL是安装了ImageResizer库的应用程序URL,而不是Azure Blob URL(在您的示例中为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. AzureReader2插件使您可以从Azure Blob读取图像,就像将它们保存在磁盘中一样。 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. 如果您以所有映像都来自Azure Blob的方式构建应用程序,则可以有两个独立的团队:一个管理您的图像(和其他媒体(如CSS))和一个管理您的代码。 With that approach AzureReader2 plugin will be very handy. 使用这种方法,AzureReader2插件将非常方便。

I hope that will help. 我希望这会有所帮助。

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. 我没有意识到前缀是您在实际URL末尾加上的内容,而不是BLOB存储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! 对于任何正在查看此内容的人来说,前缀是在实际站点而不是BLOB商店的URL上加上的内容!

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM