Copied to clipboard

Flag this post as spam?

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


  • Morten 20 posts 132 karma points
    Aug 18, 2016 @ 09:26
    Morten
    0

    Hello The macro show photos in full size in the RTE, and i want them to be showed in like 500px. Just like when you use the normal mediapicker in the RTE. The macro works fine at my website, but is just hard to use it in the RTE when the photos shows in full size

    Hope that someone can help me :)

    The macro looks like this:

    @inherits Umbraco.Web.Macros.PartialViewMacroPage
    <link href="~/css/lightbox.css" rel="stylesheet" />
    <script src="~/js/lightbox.js"></script>
    
    @*
    Macro to display a gallery of images from media the media section.
    Works with either a 'Single Media Picker' or a 'Multiple Media Picker' macro parameter (see below).
    
    How it works:
        - Confirm the macro parameter has been passed in with a value
        - Loop through all the media Id's passed in (might be a single item, might be many)
        - Display any individual images, as well as any folders of images
    
    Macro Parameters To Create, for this macro to work:
    Alias:mediaIds     Name:Select folders and/or images    Type: Multiple Media Picker
                                                            Type: (note: you can use a Single Media Picker if that's more appropriate to your needs)
    *@
    
    @{ var mediaIds = Model.MacroParameters["mediaIds"]; }
    
    @if (mediaIds != null)
    
    {
    <ul class="thumbnails" style="padding: 0px">
        @foreach (var mediaId in mediaIds.ToString().Split(','))
        {
            var media = Umbraco.Media(mediaId);
    
            @* a single image *@
            if (media.DocumentTypeAlias == "Image")
            {
                @Render(media);
            }
    
            @* a folder with images under it *@
            if (media.Children("Image").Any())
            {
                foreach (var image in media.Children("Image"))
                {
                    @Render(image);
                }
            }
    
        }
    </ul>
    }
    
    @helper Render(dynamic item)
    
    {
    <li class="col-md-3" style="list-style: none;">
        <a href="@item.umbracoFile.src" data-lightbox="gallery" data-title="@item.Name" class="thumbnail">
            <img src="@item.umbracoFile.src" alt="@item.Name" />
        </a>
    </li>
    }
    
  • Alex Skrypnyk 6132 posts 23951 karma points MVP 7x admin c-trib
    Aug 18, 2016 @ 11:26
    Alex Skrypnyk
    100

    Hi Morten,

    Do you use some styles in the RTE?

    Do you know that you can add styles to RTE?

    At the Rich Text Editor settings you can add style sheets file, and specify image sizes and other stuff in this file.

    Thanks,

    Alex

  • Alex Skrypnyk 6132 posts 23951 karma points MVP 7x admin c-trib
    Aug 25, 2016 @ 10:21
    Alex Skrypnyk
    0

    Hi Morten,

    Did you solve the issue?

    Thanks

  • Morten 20 posts 132 karma points
    Sep 06, 2016 @ 19:17
    Morten
    0

    Sorry, didnt see your replay.

    I didnt know about the style for RTE, i will try make some code that will handle it :)

    Thanks

Please Sign in or register to post replies

Write your reply to:

Draft