我正在尝试使用ImageProcessor配置 EPiServer 9 站点,但无法使其正常工作。
我已经安装了以下 nuget 包:
ImageProcessor
ImageProcessor.Web
ImageProcessor.Web.Config
使用默认配置没有任何反应。在 config/imageprocessor/security.config 中使用以下自定义配置...
<security>
<services>
<service name="CloudImageService" type="ImageProcessor.Web.Services.CloudImageService, ImageProcessor.Web">
<settings>
<setting key="MaxBytes" value="8194304" />
<setting key="Timeout" value="30000" />
<setting key="Host" value="http://site.local/globalassets/"/>
</settings>
</service>
<service prefix="remote.axd" name="RemoteImageService" type="ImageProcessor.Web.Services.RemoteImageService, ImageProcessor.Web">
<settings>
<setting key="MaxBytes" value="4194304" />
<setting key="Timeout" value="3000" />
<setting key="Protocol" value="http" />
</settings>
<whitelist>
</whitelist>
</service>
</services>
</security>
...似乎 ImageProcessor 正在尝试调整我的图像大小,但出现以下错误...
[ImageFormatException: Input stream is not a supported format.]
ImageProcessor.ImageFactory.Load(Stream stream) +523
ImageProcessor.Web.HttpModules.<ProcessImageAsync>d__34.MoveNext() +3308
System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() +31
System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) +62
System.Web.TaskAsyncHelper.EndTask(IAsyncResult ar) +64
System.Web.AsyncEventExecutionStep.OnAsyncEventCompletion(IAsyncResult ar) +162
...当尝试将图像大小调整为 200px 宽度时,如下所示:
http://site.local/globalassets/sample_image.jpg?width=200
有人对我如何让它工作有任何建议吗?图像在没有宽度参数的情况下正常显示: