Alloy MVC N00b question 2

Vote:
 

In the Alloy MVC project there is a model, partial view and controller for a image file. But it's never used when rendering images on the site? Why not if so?

Cheers

David

#83047
Mar 25, 2014 10:47
Vote:
 

This is being used when dragging images into a content area. It enables you to easily customized the rendering

#83056
Mar 25, 2014 12:13
Vote:
 

Tank you. So you do not use this when rendering images on a page outside a content area?

#83066
Mar 25, 2014 12:58
Vote:
 

When rendering an images as a property on a page, a display template is used by default. Check out Image.cshtml under DisplayTemplates in the alloy project

#83071
Edited, Mar 25, 2014 13:21
Vote:
 

When i look at Index.cshtml for ProductPage i see an image beeing rendered like this:

<div @Html.EditAttributes(x => x.CurrentPage.PageImage)>
        <img src="@Url.ContentUrl(Model.CurrentPage.PageImage)"/>
 </div>

Why is there an <img> here if you should use image.cshtml? Is not the display template used here? If not, is there an example where it is used?

#83080
Mar 25, 2014 14:56
Vote:
 

The display template is not used there. It would have been had you typed @Html.PropertyFor(x => x.CurrentPage.PageImage). 

This is done in JumbtronBlockWide.

The way it has been done in ProductPage could be useful if you want to render your image a bit different than normally, but do not want to create a new display template to do that.

#83082
Mar 25, 2014 15:05
Vote:
 

Thank you for your help!

#83086
Mar 25, 2014 15:45
Vote:
 

One more question about this:

 

How do i set the alt text to the Copyright property from the image when the image.cshtml look like this?

 

@model EPiServer.Core.ContentReference
@if (Model != null)
{
    <img src="@Url.ContentUrl(Model)" alt="" />
}

#85410
Apr 24, 2014 14:11
This topic was created over six months ago and has been resolved. If you have a similar question, please create a new topic and refer to this one.
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.