Copied to clipboard

Flag this post as spam?

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


  • Martin 278 posts 662 karma points
    Feb 04, 2015 @ 16:56
    Martin
    0

    Image ID - Grid Macro

    Hi, I've followed the great tutorial over at 24 days on inserting macros into the grid editor.

    http://24days.in/umbraco/2014/grid-macros/

    Its all working great, but Ive came across an issue regarding the images. If I change the image file associated with the media node, I loose the image inside the macro.

    Ive checked that the media node has the same node id, node name, file path and image file name. The only thing that changes is the actual image.

    Any ideas on how I could get the id of the "img" value and use that instead.

    Thanks Martin

    My macro script is

    <ul class="logo-tiles">
        @foreach (var logoTile in logoTileData)
        {
            <li>
                <div class="logo-item">
                    @if (@logoTile.link != null)
                    {
                        <a href="@Umbraco.NiceUrl(@logoTile.link.id)">
                            <img src="@logoTile.img" alt="" />
                        </a>
                    }
                    else
                    {
                        <img src="@logoTile.img" alt="" />
                    }
                </div>
            </li>
        }
    </ul>
    

    The Json from the macro

    {
    "alias": "LogoTileData",
    "name": "LogoTileData",
    "view": "/App_Plugins/LogoTileEditor/LogoTileEditor.html",
    "config": null,
    "value": [
     {
      "name": "",
      "summary": "",
      "img": "/media/1025/placeholder-test.jpg"
     }
     ]
     }
    
Please Sign in or register to post replies

Write your reply to:

Draft