Copied to clipboard

Flag this post as spam?

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


  • John 88 posts 112 karma points
    Nov 10, 2010 @ 01:50
    John
    0

    Content and related Media best practice

    Hello,

    I've installed the MutliFileUpload package and it works great as a property for a media folder adding multiple files to the media section. I also added it as a property to a document type (Gallery) and it works here, partially. It does indeed add the media files as children of the parent document type BUT only in the database, not in the umbraco.config XML.

    I've written a custom package that installs a new datatype to list out such media files stored under content items (with the ability to delete them, re-order, etc) which appears to work fine but it doesn't seem possible to pull these images out in XSLT (using GetMedia or GetNode) because they're not actually stored in the umbraco.config XML cache (I assume there's some check when generating this file that it doesn't display media items). I may be missing something otherwise I guess I've got a couple of options to resolve this and I was wondering which is the best practice approach (in terms of maintainability, future upgrades, load, etc):

    Option 1:

    I keep the muti file upload control as is and have custom:

    • Data type (.NET control) for viewing / administering the images as a property for the document type
    • User control and Macro to display the media items within a template

    Option 2:

    Create a content item (of document type Gallery Image or similar) for each media item that is to be added to the parent (of document type Gallery or similar) - this should ensure the list can be retrieved via XSLT BUT potentially will add a lot more nodes to the tree - which in turn can be done one of the below 2 ways

    • Keep the existing multi file upload control and add in an event handler (inheriting umbraco.BusinessLogic.ApplicationBase) before the save of a Media item which checks to see if it's being saved under a content item of a given document type and if so: Move the media item to a new media folder (which would be the new parent of the media item) and create a new child under the Gallery document type (of type Gallery Image or similar) which links to that moved media item via a Media Picker data type or the such
    • Create a new Multi File Upload control which will essentially do the above without having to create the umbraco.BusinessLogic.ApplicationBase event for the media BeforeSaveEvent

     

    Or perhaps there's a better way?

    Cheers

Please Sign in or register to post replies

Write your reply to:

Draft