Created
October 31, 2014 18:36
-
-
Save Jeavon/0411ca45e20d1c42ec84 to your computer and use it in GitHub Desktop.
Wrapper for GetCropUrl to set default bgColor
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
namespace MyStuff.App_Code | |
{ | |
using Umbraco.Core.Models; | |
using Umbraco.Web; | |
public static class MyHelpers | |
{ | |
public static string MyGetCropUrl(this IPublishedContent publishedContent, int width, int height) | |
{ | |
var bgColor = "fff"; | |
return publishedContent.GetCropUrl(width, height, furtherOptions: string.Format("&bgcolor={0}", bgColor)); | |
} | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@inherits UmbracoTemplatePage | |
@{ | |
var a = Model.Content.MyGetCropUrl(100, 100); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<system.web.webPages.razor> | |
<pages pageBaseType="System.Web.Mvc.WebViewPage"> | |
<namespaces> | |
<add namespace="System.Web.Mvc" /> | |
<add namespace="System.Web.Mvc.Ajax" /> | |
<add namespace="System.Web.Mvc.Html" /> | |
<add namespace="System.Web.Routing" /> | |
<add namespace="Umbraco.Web" /> | |
<add namespace="Umbraco.Core" /> | |
<add namespace="Umbraco.Core.Models" /> | |
<add namespace="Umbraco.Web.Mvc" /> | |
<add namespace="Microsoft.Web.Helpers" /> | |
<add namespace="umbraco" /> | |
<add namespace="Examine" /> | |
<add namespace="MyStuff.App_Code" /> | |
</namespaces> | |
</pages> | |
<host factoryType="System.Web.Mvc.MvcWebRazorHostFactory, System.Web.Mvc, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" /> | |
</system.web.webPages.razor> | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
No problem.
That would be a string extension method which you could do but why when you already have the IPublishedContent object?