Copied to clipboard

Flag this post as spam?

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


  • Frederik Sørensen 16 posts 130 karma points
    Mar 15, 2016 @ 07:36
    Frederik Sørensen
    0

    Easy project or way to make a simple photo gallery with text on V7.4.1?

    I don't know if this topic is in the right category but i have a problem. I have tried to make a simple lightbox photo galley with text under each picture but all the photo gallery/lightbox project's/plguins aren't working with the latest Umbraco V7.4.1 which are on my school's website that i'm currently developing. So i ask you now, is there an easy project/plugin or way to make a simple photo gallery with text + lightbox? I really appreciate your help. :)

  • Dennis Adolfi 1082 posts 6450 karma points MVP 6x c-trib
    Mar 15, 2016 @ 11:02
    Dennis Adolfi
    100

    This is not a complete solution, but more pointing you in the right direction:

    Under Settings, Select the DocumentType you´d like to have a gallery, Add a property called Images of the DataType Media Picker and tick the option Pick multiple items.

    In your Template, referencde the following CSS and JavaScript:

    <link href="https://cdnjs.cloudflare.com/ajax/libs/lightbox2/2.8.2/css/lightbox.css" rel="stylesheet">
    <script src="https://code.jquery.com/jquery-2.2.1.min.js"></script>
    <script src="https://cdnjs.cloudflare.com/ajax/libs/lightbox2/2.8.2/js/lightbox.js"></script>
    

    (Remember that CSS should be in your head and your scripts sholud be in the bottom of your body.)

    Then add the following code to render the gallery:

    @foreach (var image in CurrentPage.Images.Split(new string[] { "," }, StringSplitOptions.RemoveEmptyEntries))
    {
        var media  = Umbraco.Media(image);
        var imgSrc = media.umbracoFile;
    
        <a href="@media.umbracoFile" data-lightbox="roadtrip" data-title="My caption">
            <img src="@imgSrc"/>
        </a>
    }
    

    (Then if you´d like you´d want to refactor this to make is look prettier, i wrote this very quickly to give you an idea.)

  • Frederik Sørensen 16 posts 130 karma points
    Mar 15, 2016 @ 11:33
    Frederik Sørensen
    1

    Hey! Thanks for the answer Dennis, but i found a way to get ligthbox to finally work with "lokeshdhakar" Lightbox2, but thanks for helping me out though.

  • Dennis Adolfi 1082 posts 6450 karma points MVP 6x c-trib
    Mar 15, 2016 @ 11:38
    Dennis Adolfi
    0

    Great to hear that it worked out for you! :)

  • 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