Custom Media Type server-processed when uploaded in Umbraco 7
Hi, I'm very new to Umbraco. I like it so far, but now a bit stuck.
I have to create custom media type DarkOrLightImage, which is basically Image with an extra IsDark (True/False) property. Here are requirements:
IsDark property needs to be set automatically during file upload. I
got detection code, but I don't know where to put it. DarkOrLightImage has Upload Image property of Upload DataType. Do I need to alter it or create my own UploadWithDetection DataType which uploades and makes detection? If so, how do I do this?
I have specific media type FolderForDarkOrLightImages which allows DarkOrLightImage as child nodes only. To browse it it has Content property of FolderBrowser DataType, just like standard Folder. But when I use it to upload several DarkOrLightImages, it uploades them as standard Images. Even though Images are not allowed as child nodes for this FolderForDarkOrLightImages media type. I've already searched for solutions, but what I found was old and for previous versions of Umbraco (4, 5). Like this:
https://our.umbraco.org/forum/developers/extending-umbraco/28145-Bulk-Upload-Images-(Custom-Media-Type)
https://our.umbraco.org/projects/website-utilities/multiple-file-upload
Solution is based on altering BulkUpload package but there is no need in it, because Umbraco 7 has FolderBrowser DataType which enables you to do bulk upload. So, do I have to alter FolderBrowser or create my own similar DataType which can bulk upload my DarkOrLightImages (with dark/light detection processing)?
Anything will be appreciated, because I have just no idea how to create custom DataTypes, where to start. I found DataTypeUploadField in sources
public class DataTypeUploadField : cms.businesslogic.datatype.BaseDataType, interfaces.IDataType
but it says that
[Obsolete("IDataType and all other references to the legacy property editors are no longer used this will be removed from the codebase in future versions")]
so I even didn't manage to find it and see how it works. I very need your advice. Thanks!
Custom Media Type server-processed when uploaded in Umbraco 7
Hi, I'm very new to Umbraco. I like it so far, but now a bit stuck.
I have to create custom media type
DarkOrLightImage
, which is basicallyImage
with an extra IsDark (True/False) property. Here are requirements:IsDark property needs to be set automatically during file upload. I got detection code, but I don't know where to put it.
DarkOrLightImage
has Upload Image property ofUpload
DataType. Do I need to alter it or create my ownUploadWithDetection
DataType which uploades and makes detection? If so, how do I do this?I have specific media type
FolderForDarkOrLightImages
which allowsDarkOrLightImage
as child nodes only. To browse it it has Content property ofFolderBrowser
DataType, just like standardFolder
. But when I use it to upload several DarkOrLightImages, it uploades them as standard Images. Even though Images are not allowed as child nodes for this FolderForDarkOrLightImages media type. I've already searched for solutions, but what I found was old and for previous versions of Umbraco (4, 5). Like this: https://our.umbraco.org/forum/developers/extending-umbraco/28145-Bulk-Upload-Images-(Custom-Media-Type) https://our.umbraco.org/projects/website-utilities/multiple-file-upload Solution is based on altering BulkUpload package but there is no need in it, because Umbraco 7 hasFolderBrowser
DataType which enables you to do bulk upload. So, do I have to alterFolderBrowser
or create my own similar DataType which can bulk upload myDarkOrLightImage
s (with dark/light detection processing)?Anything will be appreciated, because I have just no idea how to create custom DataTypes, where to start. I found
DataTypeUploadField
in sourcesbut it says that
so I even didn't manage to find it and see how it works. I very need your advice. Thanks!
Hi Roman,
Welcome to community. What version of Umbraco are you using?
How to create property editor for Umbraco 7 - https://our.umbraco.org/Documentation/Extending-Umbraco/Property-Editors/creating-tutorial1-v7
Thanks, Alex
Hi Alex! Thanks for response.
I'm using Umbraco version 7.2.2 assembly: 1.0.5529.18522.
I may be missing something, but tutorial link you provided refers to creating property editor on client-side only, like some special editing functionality. It creates data on a client and it goes into db like some text data. Whereas I need to upload file and do something with it on server side. May be I need to create some class like this? https://github.com/umbraco/Umbraco-CMS/blob/7.2.0/src/Umbraco.Web/PropertyEditors/FileUploadPropertyValueEditor.cs#L87
I store images in Media section under some folder. In the Content section I have Homepage with "ShowcaseImages" property:
ShowcasePhotos (ShowcasePhotos), Type: Multiple Media Picker
and I pick photos.
is working on a reply...