We've always treated Media as external content in our packages...there are some work items in CodePlex related to this if you'd like to help vote them up.
Have a look at the CWS package for a good example of using Media as external content.
I can understand treating the media itself as external content and adding it to the package in the files section. However, will it be available in the Media section post install? I assume that it won't.
I just find it odd that there is no way to add Media Types and Member Types to a package the same way you add Document Types. That is kind of limiting.
Adding media items to a package would also be very helpful, a website package of mine has come to a standstill as I don't want to have to put all the example pictures in the content section. what to do in these situations?
I've looked at the source code of Umbraco and you should be able to programmatically add a media type. You could do this on a post install user control I think. Here is some sample code:
MediaType m = MediaType.MakeNew(adminUser, "Custom Media type");
int tabId = m.AddVirtualTab("test tab");
m.AddPropertyType(new datatype.DataTypeDefinition(1087), "testProperty", "Test property");
m.SetTabOnPropertyType(new property.Property(100), tabId);
The only problem is in the last line you need the id of the property you added, but m.AddPropertyType doesn't return anything. Maybe that should be a codeplex issue.
Including Media Types in Package
I noticed that there is no option for including media or media types in the package creator. Is there any way to do this? Package actions maybe?
We've always treated Media as external content in our packages...there are some work items in CodePlex related to this if you'd like to help vote them up.
Have a look at the CWS package for a good example of using Media as external content.
-Paul
I can understand treating the media itself as external content and adding it to the package in the files section. However, will it be available in the Media section post install? I assume that it won't.
I just find it odd that there is no way to add Media Types and Member Types to a package the same way you add Document Types. That is kind of limiting.
Agree, adding media types to a package would be great!
@Ricky: would you be so kind to add this as a feature on Codeplex, I'll certainly vote for it!
Cheers,
/Dirk
Done.
http://umbraco.codeplex.com/WorkItem/View.aspx?WorkItemId=24617
Thanks guys!
Hiya guys,
I have voted for this recently, but is there a way to resolve this with a package action or a post install usercontrol at all?
Cheers,
Warren
Adding media items to a package would also be very helpful, a website package of mine has come to a standstill as I don't want to have to put all the example pictures in the content section. what to do in these situations?
Hi,
I've looked at the source code of Umbraco and you should be able to programmatically add a media type. You could do this on a post install user control I think. Here is some sample code:
The only problem is in the last line you need the id of the property you added, but m.AddPropertyType doesn't return anything. Maybe that should be a codeplex issue.
Jeroen
Hi Warren,
I think Jeroen's solution is pretty much the solution, though in response to the issue raised, you can get a refference to the property type by alias:
mediaType.getPropertyType("testProperty");
so the last line becomes
Matt
PS A good example of adding a media type at package install can be found in the source of Noerds Multiple File Upload package
http://github.com/noerd/Multiple-File-Upload-Package/blob/master/src/noerd.Umb.DataTypes.multipleFileUpload.web/usercontrols/MultipleFileUpload/Installer.ascx.cs
Matt
Any progress on this? any plugins that add media types to a package? Can't understand why this isn't added to Umbraco!
is working on a reply...