Exemple #1
0
        public Config(ResizerSection config, bool addAspNetPlugins)
        {
            this.configuration = config;

            //Init plugins module
            plugins = new PluginConfig(this);

            //Whenever the extensions change, the image builder instance has to be replaced.
            plugins.ImageBuilderExtensions.Changed += delegate(SafeList <BuilderExtension> s) {
                InvalidateImageBuilder();
            };

            //Relies on plugins, must init second
            pipeline = new PipelineConfig(this);


            //Load default plugins
            new ImageResizer.Plugins.Basic.DefaultEncoder().Install(this);
            new ImageResizer.Plugins.Basic.NoCache().Install(this);
            new ImageResizer.Plugins.Basic.ClientCache().Install(this);
            new ImageResizer.Plugins.Basic.WebConfigLicenseReader().Install(this);

            if (addAspNetPlugins)
            {
                new ImageResizer.Plugins.Basic.Diagnostic().Install(this); //2017-04-04 - this plugin only sets the HTTP handler; adds no other functionality.
                new ImageResizer.Plugins.Basic.SizeLimiting().Install(this);
                new ImageResizer.Plugins.Basic.MvcRoutingShimPlugin().Install(this);
                new ImageResizer.Plugins.Basic.LicenseDisplay().Install(this);
            }

            //Load plugins immediately. Lazy plugin loading causes problems.
            plugins.LoadPlugins();

            pipeline.FireHeartbeat();
        }
Exemple #2
0
        public Config(ResizerSection config)
        {
            this.configuration = config;

            //Init plugins module
            plugins = new PluginConfig(this);

            //Whenever the extensions change, the image builder instance has to be replaced.
            plugins.ImageBuilderExtensions.Changed += delegate(SafeList <BuilderExtension> s) {
                InvalidateImageBuilder();
            };

            //Relies on plugins, must init second
            pipeline = new PipelineConfig(this);

            bool isAspNet = System.Web.Hosting.HostingEnvironment.ApplicationPhysicalPath != null;

            //Load default plugins
            new ImageResizer.Plugins.Basic.DefaultEncoder().Install(this);
            new ImageResizer.Plugins.Basic.NoCache().Install(this);
            new ImageResizer.Plugins.Basic.ClientCache().Install(this);
            new ImageResizer.Plugins.Basic.Diagnostic().Install(this);
            if (isAspNet)
            {
                new ImageResizer.Plugins.Basic.SizeLimiting().Install(this);
            }

            //Load plugins immediately. Lazy plugin loading causes problems.
            plugins.LoadPlugins();
        }