Copied to clipboard

Flag this post as spam?

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


  • Rihab 104 posts 388 karma points
    Jul 16, 2018 @ 09:26
    Rihab
    0

    The type or namespace name 'Image' could not be found (are you missing a using directive or an assembly reference?)

    Hi, i just started my free trail umbraco cloud, i cloned the project locally and at the first build i got 5 errors: Severity Code Description Project File Line Suppression State Error The type or namespace name 'Image' could not be found (are you missing a using directive or an assembly reference?)
    \Umbraco\PartialViewMacros\Templates\Gallery.cshtml\

    this is my Gallery.cshtml code.

        @inherits Umbraco.Web.Macros.PartialViewMacroPage
    @*
        Macro to display a gallery of images from 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 Ids 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"] as string; }
    
    @if (mediaIds != null)
    {
        <div class="row">
            @foreach (var mediaId in mediaIds.Split(','))
            {
                var media = Umbraco.TypedMedia(mediaId);
    
                @* a single image *@
                if (media.DocumentTypeAlias == "Image")
                {
                    @Render(media as Image);
                }
    
                @* a folder with images under it *@
                foreach (var image in media.Children<Image>())
                {
                    @Render(image);
                }
            }
        </div>
    }
    
    @helper Render(Image item)
    {
        <div class="col-xs-6 col-md-3">
            <a href="@item.Url" class="thumbnail">
                <img src="@item.GetCropUrl(width:200, height:200)" alt="@item.Name" />
            </a>
        </div>
    }
    
  • Tor Langlo 191 posts 554 karma points
    Jul 16, 2018 @ 21:27
  • Alex Skrypnyk 6182 posts 24284 karma points MVP 8x admin c-trib
    Jul 17, 2018 @ 08:37
    Alex Skrypnyk
    1

    Hi

    Add to header, please:

    @inherits Umbraco.Web.Macros.PartialViewMacroPage
    @using Umbraco.Web.PublishedContentModels
    

    Thanks,

    Alex

  • Alex Skrypnyk 6182 posts 24284 karma points MVP 8x admin c-trib
    Jul 17, 2018 @ 08:44
    Alex Skrypnyk
    100

    And of course read the topic that Tor pointed - https://our.umbraco.com/forum/umbraco-cloud/91962-build-error#comment-293056

    Can be the case

  • Alex Skrypnyk 6182 posts 24284 karma points MVP 8x admin c-trib
    Jul 30, 2018 @ 14:38
    Alex Skrypnyk
    0

    Hi

    Is this topic solved?

  • 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