Copied to clipboard

Flag this post as spam?

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


  • doing1024 3 posts 33 karma points
    Dec 23, 2012 @ 18:12
    doing1024
    0

    How to get the image URL from CDATA section

    Hey,

    I insert a image into the Richtext Editor(alias: articleContents), after I published the article, in umbraco.config file, the XML node like this: 

    <articleContents><![CDATA[<p>some text</p><p><img src="/media/9486/201212111646332278_500x328.jpg"  width="500"  height="328" alt="201212111646332278"/></p><p>some text</p>]]></articleContents>

    Now, I only need to display the picture and ignore the text, so I have to get the image URL.

    Because the image isn't uploaded by the upload picker, I can't using umbraco.library:GetMedia() to get the image URL.  How to get the image URL from CDATA section? Thank you!

  • Jan Skovgaard 11258 posts 23500 karma points MVP 7x admin c-trib
    Dec 25, 2012 @ 20:37
    Jan Skovgaard
    100

    Hi Doing1024 and welcome to our :)

    Is there any specific reason why you want to fetch the image only from at rich text editor? Why don't you just use a media picker? What is your use case for doing it like mentioned above?

    If you want to do it the hard way I think you can benefit from reading through this article by Chriztian Steinmeier http://pimpmyxslt.com/articles/wysiwyg/ - This sound like the thing you're after. But I'm still curious as to why you want to do it that way :)

    /Jan

  • doing1024 3 posts 33 karma points
    Dec 26, 2012 @ 16:02
    doing1024
    0

     

    Hi, Jan, Thank you for your help. It works! Actually, when a writer inserts a image into RichTtext Editor, I need to fetch the image and show it in the photo slider like this:

    For website visitors, they can visit the article page by clicking on the photo slider. If I use a media picker in the backoffice, the writer will feel confused. They have to point the article preview photo after they already inserted the photo in RichText Editor. I just want to make it easy and quick for the writer.

    Thank you for your help again and Happy New Year 2013!

  • Jan Skovgaard 11258 posts 23500 karma points MVP 7x admin c-trib
    Dec 26, 2012 @ 16:09
    Jan Skovgaard
    0

    Hi doing1024

    I agree that the less the editor needs to worry about the better - from what you describe above this seems like a very elegant solution :)

    Remember to mark the post as solved so others can quickly go to the post with the solution.

    Happy new year to you as well and happy umbracoing :)

    /Jan

  • This forum is in read-only mode while we transition to the new forum.

    You can continue this topic on the new forum by tapping the "Continue discussion" link below.

Please Sign in or register to post replies