Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Ricky Beard 61 posts 116 karma points
    Sep 11, 2009 @ 18:31
    Ricky Beard
    1

    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?

  • Paul Sterling 718 posts 1534 karma points MVP 9x admin c-trib
    Sep 11, 2009 @ 19:06
    Paul Sterling
    0

    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

  • Ricky Beard 61 posts 116 karma points
    Sep 11, 2009 @ 19:45
    Ricky Beard
    0

    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.

  • Dirk De Grave 4541 posts 6021 karma points MVP 3x admin c-trib
    Sep 11, 2009 @ 20:41
    Dirk De Grave
    0

    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

  • Ricky Beard 61 posts 116 karma points
    Sep 11, 2009 @ 22:06
  • Warren Buckley 2106 posts 4836 karma points MVP 7x admin c-trib
    Oct 25, 2010 @ 20:28
    Warren Buckley
    0

    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

  • wolulcmit 357 posts 693 karma points
    Oct 25, 2010 @ 22:41
    wolulcmit
    0

    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?

  • Jeroen Breuer 4908 posts 12265 karma points MVP 5x admin c-trib
    Oct 26, 2010 @ 09:51
    Jeroen Breuer
    1

    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:

    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.

    Jeroen

     

  • Matt Brailsford 4125 posts 22223 karma points MVP 9x c-trib
    Oct 26, 2010 @ 10:07
    Matt Brailsford
    1

    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

    m.SetTabOnPropertyType(m.getPropertyType("textProperty"), tabId);

    Matt

  • Matt Brailsford 4125 posts 22223 karma points MVP 9x c-trib
    Oct 26, 2010 @ 10:10
    Matt Brailsford
    1

    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

  • Edwin van Koppen 156 posts 270 karma points
    Mar 11, 2015 @ 09:22
    Edwin van Koppen
    0

    Any progress on this? any plugins that add media types to a package? Can't understand why this isn't added to Umbraco!

Please Sign in or register to post replies

Write your reply to:

Draft