Copied to clipboard

Flag this post as spam?

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


  • Ismail Mayat 4511 posts 10090 karma points MVP 2x admin c-trib
    Aug 23, 2011 @ 15:53
    Ismail Mayat
    0

    Add image to DAMP datatype using API

    I have DAMP property on my doctype the data is stored as xml.  How do I go about adding an existing image in the media section the document using Umbraco api?

    Regards

    Ismail

  • Jeroen Breuer 4908 posts 12265 karma points MVP 4x admin c-trib
    Aug 23, 2011 @ 16:28
    Jeroen Breuer
    1

    Hello,

    There aren't any real samples for this, but there might be some usefull things in the source code.

    In DigibizAdvancedMediaPicker.ascx.cs there is method called GetXML() and GetMediaElements(string id). These are the methods which will store the selected images as media xml.

    In DAMP_ApplicationBase.cs there is a method called UpdateDAMP(Media media, bool deleteMediaItem). This method makes sure if you update an image in the media section it also gets updated on the documents which store the media xml.

    So hopefully you can use this code to add an existing image.

    Jeroen

  • Ismail Mayat 4511 posts 10090 karma points MVP 2x admin c-trib
    Aug 23, 2011 @ 17:42
    Ismail Mayat
    0

    Jeroen,

    Cool many thanks. Just interested in first suggestion as I am looking to create a fieldadaptor for cmsimport and the document type has DAMP field, so will have a play with your suggestion

    Many thanks

    Ismail

  • Jeroen Breuer 4908 posts 12265 karma points MVP 4x admin c-trib
    Aug 24, 2011 @ 13:59
    Jeroen Breuer
    0

    Just a quick note. The GetMediaElements(string id) method from my first suggestion has changed since DAMP 1.0. First I used library.GetMedia, but I changed it in DAMP 2.0 because I had some problems: 

    http://umbraco.codeplex.com/workitem/30234
    http://umbraco.codeplex.com/workitem/30235

    So in DAMP 2.0 I get the xml directly from the cmsContentXml table which solved it. If you want to create a fieldadaptor I suggest you use the code from DAMP 2.0, but I just wanted to let you know that DAMP 1.0 is different.

    Jeroen

  • Jeroen Breuer 4908 posts 12265 karma points MVP 4x admin c-trib
    Sep 05, 2011 @ 18:24
    Jeroen Breuer
    0

    Hi Ismail,

    Did you succeeded in creating a fieldadaptor for cmsimport using my samples?

    Jeroen

Please Sign in or register to post replies

Write your reply to:

Draft