以编程方式配置ImageResizing.Net [英] Configuring ImageResizing.Net Programmatically

查看:92
本文介绍了以编程方式配置ImageResizing.Net的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在类库中使用 ImageResizing.Net 作为需要绕过Web的后端的一部分通过使用如下代码安装插件来配置.Config/App.Config:

I'm using ImageResizing.Net within a class library as part of a back-end which requires bypassing Web.Config/App.Config by installing plugins in code like so:

ImageResizer.Configuration.Config.Current.Plugins.Install(new ImageResizer.Plugins.SimpleFilters.SimpleFilters());
ImageResizer.Configuration.Config.Current.Plugins.Install(new ImageResizer.Plugins.AdvancedFilters.AdvancedFilters());

我已经验证了插件是否在其中加载:

I've verified that plugins are loaded within:

ImageResizer.Configuration.Config.Current.Plugins

调用 imageJob.Build(); 时出现以下错误:

无法加载文件或程序集"AForge.Imaging,版本= 2.2.5.0,区域性=中性,PublicKeyToken = ba8ddea9676ca48b"或其依赖项之一.系统找不到指定的文件.

Could not load file or assembly 'AForge.Imaging, Version=2.2.5.0, Culture=neutral, PublicKeyToken=ba8ddea9676ca48b' or one of its dependencies. The system cannot find the file specified.

希望这可以通过直接引用库来解决.我在使用ImageResizer的类的顶部添加了以下using语句:

Hoping this could be solved by referencing the libraries directly I've added the following using statements to the top of the class that uses ImageResizer:

using AForge;
using AForge.Imaging;
using AForge.Imaging.Filters;
using AForge.Imaging.ColorReduction;
using AForge.Imaging.ComplexFilters;
using AForge.Imaging.Textures;

我仍然遇到相同的错误.我已经验证我的项目中存在AForge引用,它们是正确的版本,并且复制本地"设置为真".这些引用是随Nuget软件包一起自动安装的依赖项的一部分,该软件包用于ImageResizing&关联的插件.

Am still getting the same error. I've verified that the AForge references exist in my project, are the correct version and have "Copy Local" set to "True". These references were part of the dependencies that were automatically installed with the Nuget Packages for ImageResizing & the associated plugins.

更新

由于该库不是针对这种情况设计的,因此我决定将图像处理移至Web api.库的作者在本S.O.问题.我会将其标记为答案.

I've decided to move the image processing over to a web api since the library was not designed for this scenario. This is called out by the author of the library in the comments of this S.O. question . I will mark this as the answer.

推荐答案

由于库不是针对这种情况设计的,因此我决定将图像处理移至Web api.库的作者在本S.O.问题

I've decided to move the image processing over to a web api since the library was not designed for this scenario. This is called out by the author of the library in the comments of this S.O. question

这篇关于以编程方式配置ImageResizing.Net的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆