Join us this Friday for AI in Action at the Virtual Happy Hour! This free virtual event is open to all—enroll now on Academy and don’t miss out.

 

Image Data Preview

Vote:
 

Hi All,

I've trying to switch default property preview for a custom one. I followed this article: http://world.episerver.com/documentation/Items/Developers-Guide/EPiServer-CMS/75/Content/Assets-and-media/Custom-editing-preview-for-media/.

For some reason I created a custom view for the preview. Once compiled and run it is not being picked up by the CMS. Instead the default preview is not displaying a preview any more:

I am very quite new to the platform - must be something very lame!

Many thanks,

M

#140833
Oct 31, 2015 12:34
Vote:
 

Hi,

Could you show your code? And give more details what would you like to implement?

#140835
Oct 31, 2015 16:13
Vote:
 

Hey,

I would like to use it to as a page where the custom image cropping tool will be located.

In terms of the code, I followed the documentation (link in the previous post):

[TemplateDescriptor(Default = true, Tags = new[] { RenderingTags.Preview })]
public partial class ImageFilePreview : PreviewPage, IRenderTemplate<ImageFile>
{

}



Thanks, M

#140837
Edited, Oct 31, 2015 21:35
Vote:
 

As far as I remember (could be wrong) Media data preview handler is responsible for this. It has following attributes set:

[TemplateDescriptor(AvailableWithoutTag = false, Inherited = true, TagString = "Preview", TemplateTypeCategory = TemplateTypeCategories.HttpHandler)]
public class ImagePreviewHandler : MediaPreviewHandlerBase, IRenderTemplate<IContentImage>, IRenderTemplate
{
}
#140926
Nov 03, 2015 23:19
Vote:
 

This is how we've solved it for a generic file in a project. Guess it should work for image as well.

[TemplateDescriptor(
        Inherited = true,
        AvailableWithoutTag = false,
        Tags = new[] { RenderingTags.Edit },
        TemplateTypeCategory = TemplateTypeCategories.MvcController,
        Path = "/Views/GenericMedia/Index.cshtml"
        )]
    public class GenericMediaController : ActionControllerBase, IRenderTemplate<GenericMedia>
    {
        public ActionResult Index(GenericMedia currentBlock)
        {
            return View(currentBlock);
        }
    }
#140930
Nov 04, 2015 9:16
* 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.