Try our conversational search powered by Generative AI!

Why create MediaTypes?

Vote:
 

Hi,

I don't understand why do we need to additionally create extended media type models, as explained here - https://world.episerver.com/documentation/developer-guides/CMS/Content/assets-and-media/Media-types-and-templates/ ?

Without doing it will there be no "Media" tab in "Assets Panel" and I won't be able to upload images, videos, documents?

Thank you for your clarification.

#205616
Jul 17, 2019 14:47
Vote:
 
  1. You want to specify what type of files should be possible to upload for an editor. Should it only be jpgs and pdfs or are other formats ok? From a security perspective it’s good to have this as a whitelist so editors are not normally able to upload .exe files etc
  2. Different types of media might need different types of additional properties. E.g. photographer and alt text is normally a good one to have on an image while a pdf might have author etc.
  3. If you have different media types it makes it easier later to do more advanced functionality like image search etc. Think SOLID architecture principles...
#205617
Jul 17, 2019 14:57
fuji - Jul 17, 2019 15:02
Thanks, it becomes clearer. But does it mean that inherited model doesn't specify/limit file extensions?

PS.: Do we really need Controller returning partial view of our media type model? Does it mean that every time we include an image, video, document into an EPiServer post/page it includes that model's partial view? -- EDIT: After I tried to include video inside one of the pages, it is not wrapped into partial view's code, so I suppose it's not why we need View for our media type models? EDIT: Ok, now I see that the Controller and the partial view are used only when I drag'n'drop this media type, but not include as media through TINYMCE.
Vote:
 

I think it's a good idea to inherit from the base class and then do whatever you want to do because -

  1. It will give you the freedom to restrict/allow the things that you want. Like if you want to restrict the .zip file upload to your application then you can implement this by removing the .zip extension from your class.
  2. If you want to search the specific type of media then you can create a class and add that type of media extension in that class and search based on that class.
  3. You can also extend or add new properties on the class so that can be used on your view file.

So overall it's good to have an ability to extend the class instead of using the default class.

Thanks

Ravindra

#205702
Jul 19, 2019 17:08
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.