November Happy Hour will be moved to Thursday December 5th.
AI OnAI Off
November Happy Hour will be moved to Thursday December 5th.
Managed to figure it out after seeing that dragging and dropping media worked in the Alloy demo (was testing in the training project at first).
Key seems to be injecting the UrlResolver.
[TemplateDescriptor(Inherited = true)] public partial class Image : ContentControlBase<ImageFile> { protected Injected<UrlResolver> UrlResolver { get; set; } protected string ImageUrl { get { return UrlResolver.Service.GetUrl(CurrentData.ContentLink); } } protected void Page_Load(object sender, EventArgs e) { DataBind(); } }
<img src="<%# ImageUrl %>" />
You can also use UrlResolver.Current.GetUrl as well without injection in 7.5
Fab, that's good to know. Thanks!
Think I've got a lot more reading and discovering to do to get the hang of this.
Hi,
I'm quite new to EPiServer (recently done the fundamentals course) but I noticed you can actually drag images and other media directly from the assets pane into a content area - which seemed kinda neat. However what I've not been able to figure out is how to create a template off of it.
What I end up with is a User Control inheriting from ContentControlBase<ImageFile> with ImageFile itself inheriting from ImageData. However on the course I've not worked with ImageData directly for rendering it has been ContentRefernce or Url types on page and block types and using the EPiServer:Property tags, and I've not really been able to figure out the best way to generate the image tag directly.
I suppose I'm also concerned with making sure it respects any permissions and such that might be controlling who can access the file.
Anyone have any tips or resources I should look at that might help me out?
Thanks,
Mark