This project is read-only.

mediapicker image showing twice in widget

Topics: Customizing Orchard, Troubleshooting
Apr 5, 2013 at 11:23 AM
Edited Apr 5, 2013 at 11:24 AM

I have created a widget that is only supposed to show some text and an image.
At first I only had a textbox where a user could enter the path to the image, which worked fine, but now I added a mediapicker instead.
The problem is that it shows the image twice! O_O


And here's the view
<div href="@(Model.Href)" 
    class="box25 no-decoration @(Model.Last ? "last" : "")">
    <h3 class="h-pad">@(Model.Title)</h3>                               
    <img src="@Href(Model.ContentItem.PuffPart.ImageLink.Url)" class="box-image">  
    <div class="box-text">@(new MvcHtmlString(Model.Body))</div>                       
I have googled and searched this forum since yesterday, and I can't seem to find anyone with the same issue. Is there anyone that has seen this before?

Thanks in advance!

Apr 6, 2013 at 5:03 PM
Could you show us the rendered HTML, representing the two images?
Apr 8, 2013 at 9:03 AM
Of course! :)

The first div with href "test" is the correct one from the template, and the p-tag at the end is the extra that Orchard is adding.
And I can't figure out how to remove the extra one : /
<article class="widget-test widget-start-page-center widget-puff-widget widget">
    <script shape-hint="" shape-type="Parts_Puff" shape-id="7" class="shape-tracing-wrapper"></script>
    <div class="box25 no-decoration " href="test">
        <h3 class="h-pad">test</h3>                               
        <img class="box-image" src="/Media/Default/StartPage/start-1.png">  
        <div class="box-text"><p>test</p></div>                       

    <script end-of="7" class="shape-tracing-wrapper"></script>
    <script shape-hint="" shape-type="Parts_Contents_Publish" shape-id="8" class="shape-tracing-wrapper"></script>
    <script end-of="8" class="shape-tracing-wrapper"></script>
    <script shape-hint="" shape-type="Fields_MediaPicker" shape-id="9" class="shape-tracing-wrapper"></script>

    <p class="media-picker-field media-picker-field-image">
         <img src="/Media/Default/StartPage/start-1.png">

    <script end-of="9" class="shape-tracing-wrapper"></script>
Apr 8, 2013 at 9:40 AM
Solved it with the placement file
<Place Fields_MediaPicker="-"/>