Try our conversational search powered by Generative AI!

Select content type for media file?

Vote:
 

Hi!

I have created a media content type with some properties for the following extensions jpg,jpeg,jpe,ico,gif,bmp,png. The problem is that all media files with those file extensions gets the contenttype when uploaded and I only want the content type on some of the files uploaded. Is it possible to select what content type to use when uploading the file or is there some other way to set the MediaDescriptor other than the extensions string, like folder, filename? 

#87049
Jun 09, 2014 13:21
Vote:
 

Not sure I fully understand. Why would you add all of the types if you do not wish the class to be used for all of them?

The extension string will decide what Media type episerver will create. If you wish diffrent MetaData on the diffrent types I would create a type for each. 

The types can ofcourse inherit from each other. So you could have a base type say "ImageFile" that inherits from ImageData and has the properties for Description and Copyright as this is used on all the file tyes. This has no MediaDescriptor attribute.

Then you create a type "JpegFile" that inherits from ImageFile there by getting the Description and Copyright and then you can add you specific properties to that. And on this you add the MediaDescriptor for jpg and jpeg

#87056
Jun 09, 2014 14:23
Vote:
 

Thanks for your reply Petter. I will try to explain a bit better. Lets say I created a media type named Summer with some properties only related to summer activites and I want all uploaded media files with extension jpg,jpeg,jpe,ico,gif,bmp,png with a summer theme to get that media type, but not all uploaded media files with extension jpg,jpeg,jpe,ico,gif,bmp,png are summer pictures and therefore shouldn't get the media type named summer. Is there a way to get around the fact that all jpg,jpeg,jpe,ico,gif,bmp,png gets the samt content type. 

#87061
Jun 09, 2014 14:48
Vote:
 

Right nowI get the issue =)

Well in that case I would add a Initilize module to hook on the upload event. And then in that code check something.. lets say if folder is summerpictures and in that case set the Theme property on the Media type.

#87063
Jun 09, 2014 14:53
Vote:
 

Ok, I will look in to that. Thanks!

#87085
Jun 09, 2014 16:20
* 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.