AI OnAI Off
Hi, the 'ImageFile' that you have created is a content type and not a property type. See the Episerver documentation about how to create custom property types.
To use the image on a page type as property you need to use the ContentReference type for the property and optionally you can limit what kind of content can be referenced in the property.
For example like this on a page type:
[AllowedTypes(new Type[] { typeof(ImageFile) })] // allow only your ImageFile type here [UIHint(UIHint.Image)] public virtual ContentReference MyImageProperty { get; set; }
I made a class which inherits from ImageData:
[ContentType(GUID = "584F4521-65A3-4C77-BF9A-677A124FDFA9")]
[MediaDescriptor(ExtensionString = "jpg,jpeg,jpe,ico,gif,bmp,png")]
public class ImageFile : ImageData
{
public virtual int Height { get; set; }
public virtual int Width { get; set; }
public virtual string Title { get; set; }
}
I am using it as a property for a page as below:
[Display(Name = "Sample",Description = "They display images of the samples.",GroupName = SystemTabNames.Content,Order = 10)]
[CultureSpecific]
[Required]
public virtual ImageFile SampleImage { get; set; }
But when I try and run the application it gives me an error: 'ImageFile' could not be mapped to a PropertyDefinitionType
Am I missing any attribute to map this?