Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for presets in addition to manual/individual width param #2

Open
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

MarcStoecker
Copy link
Contributor

Extended the filter to use presets if no width given, but a preset parameter. Also updated the readme and switched Visual Studio project configuration to use IIS Express and updated web.config.

@ChrisMcKee
Copy link

+1 for presets. Great addition

&& (src.Value.IndexOf("preset=", StringComparison.InvariantCultureIgnoreCase) > -1))
{
// - get presets from config
var configSection = WebConfigurationManager.GetSection("resizer") as ImageResizer.ResizerSection;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we're depending on ImageResizer.ResizerSection anyway, it's probably better to just call Config.Current.getConfigXml().queryFirst("presets") so we don't miss elements with case variations. ImageResizer has case-insensitive configuration, unlike the .NET XML library. Copy/paste from https://github.com/imazen/resizer/blob/master/Core/Plugins/Basic/Presets.cs if you want.

ImageResizer also supports the semicolon syntax, not just querystring, so using new Instructions() to parse will enable that. Instructions.Width will return either 'width' and 'w', but not 'maxwidth'. instructions.Get<int>("maxwidth") lets you access that.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the heads up with the semicolon separated instructions! Will fix that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants