Copied to clipboard

Flag this post as spam?

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


  • Fuji Kusaka 2203 posts 4220 karma points
    May 08, 2014 @ 09:43
    Fuji Kusaka
    0

    Image wont display

    Hi guys,

    Am having a very weird issue here where i have a media picker which is used to display images from a specific folder from the media section. 

    For some reason, the images wont load on my front page. When inspecting with Chrome there is nothing in the html file under this section when using xslt. 

    If however i make use of razor i get an ugly error loading script. 

    I have to Republish the page and all child pages for the images to display and this is causing a lot of frustration since if images are not loaded we cant actually click on any Urls.

    Is there a problem when trying my code is trying to access media section ? Am using v4.11.8 Assembly version: 1.0.4869.17899 and this website has been upgraded from 4.7 to 4.11.8 last year.

    I cant possibly upgrade it again cost we have more than a 1000 nodes here.

    Any suggestion what i can do ?

    //fuji

  • Jan Skovgaard 11280 posts 23678 karma points MVP 11x admin c-trib
    May 08, 2014 @ 10:22
    Jan Skovgaard
    0

    Hi Fuji

    What does your code look like and have you checked that the image in fact does exist in the /media/ folder?

    /Jan

  • Fuji Kusaka 2203 posts 4220 karma points
    May 08, 2014 @ 11:16
    Fuji Kusaka
    0

    Hi Jan,

    Yes all images are present. I have to publish the node once more for the images to show up. 

    It goes on and on like this, sometimes  image show up and sometime they dont. To resolve this i have to publish the page again. But i cant spend my time monitoring when image will be displayed or not.

  • Jan Skovgaard 11280 posts 23678 karma points MVP 11x admin c-trib
    May 08, 2014 @ 11:18
    Jan Skovgaard
    0

    Hi Fuji

    Are all permissions setup correctly?

    Have you checked the /app_data/logs file to see if it reveals some useful information? Any errors in there?

    /Jan

  • Fuji Kusaka 2203 posts 4220 karma points
    May 08, 2014 @ 11:22
    Fuji Kusaka
    0

    Well i even stop the app pool, delete all files from tha app_data and restart services but no success, sometime it shows up and then just wont work.

  • Fuji Kusaka 2203 posts 4220 karma points
    May 08, 2014 @ 11:42
    Fuji Kusaka
    0

    Here is how my code looks like anyway, but i dont think there is any problem with the code below.

    Razor

    @using umbraco.MacroEngines;
    @using umbraco.cms.businesslogic.media;
    @using umbraco.BusinessLogic;
    @inherits umbraco.MacroEngines.DynamicNodeContext
    
        @{
                var imgFolder = Model.AncestorsOrSelf().Where("uploadlandingBg !=\"\"").Last().uploadlandingBg;
    
                if(imgFolder !="")  {
                                 int folderId = Convert.ToInt32(@imgFolder);
                                 var startSlider = new Media(@folderId);
                                 IEnumerable<Media> slides = startSlider.GetChildMedia().Where(x => x.ContentType.Alias == "Image");
                <div class="flexslider" > 
                         <ul class="slides"> 
                             @foreach(var img in slides){
                                <li><img src="@img.getProperty("umbracoFile").Value" alt="@img.Text"></li>
                             }
                         <a href="#" class="slidesjs-previous slidesjs-navigation">&nbsp;</a>
                                 <a href="#" class="slidesjs-next slidesjs-navigation">&nbsp;</a>   
                         </ul>
                </div>
    } }

    xslt 

    <xsl:variable name="mediapickerproperty" select="$currentPage/uploadlandingBg"/> 
    <xsl:variable name="slideshow" select="$currentPage/ancestor-or-self::*[normalize-space(uploadlandingBg)][1]/uploadlandingBg" />
    
    
    <xsl:template match="/">   
         <xsl:if test="$slideshow &gt; 0">
               <div class="flexslider" > 
                     <ul class="slides">        
                            <xsl:for-each select="umbraco.library:GetMedia($slideshow, 1)/Image">
                                <li>   
                                    <img>
                                        <xsl:attribute name="src">
                                            <xsl:value-of select="umbraco.library:GetMedia(@id, 0)/umbracoFile"/>
                                        </xsl:attribute>
                                    </img>
                                </li>                 
                            </xsl:for-each>
                            <a href="#" class="slidesjs-previous slidesjs-navigation">&nbsp;</a>
                            <a href="#" class="slidesjs-next slidesjs-navigation">&nbsp;</a>    
                    </ul>
                  </div> 
                </xsl:if>
            </xsl:template>
  • Fuji Kusaka 2203 posts 4220 karma points
    May 08, 2014 @ 15:02
    Fuji Kusaka
    0

    Hi Jan,

    Here is what i got from my log files

    2014-05-08 00:00:08,550 [150] WARN  umbraco.macro - [Thread 24] Error loading MacroEngine script (file: slideshow.cshtml, Type: ''. Exception: System.InvalidOperationException: Sequence contains no elements

       at System.Linq.Enumerable.Last[TSource](IEnumerable`1 source)

       at System.Linq.Queryable.Last[TSource](IQueryable`1 source)

       at umbraco.MacroEngines.DynamicNodeList.TryInvokeMember(InvokeMemberBinder binder, Object[] args, Object& result)

       at CallSite.Target(Closure , CallSite , Object )

       at ASP._Page_macroScripts_lux_season_sticker_cshtml.Execute() in c:\inetpub\lux\macroScripts\lux-season-sticker.cshtml:line 6

       at System.Web.WebPages.WebPageBase.ExecutePageHierarchy()

       at System.Web.WebPages.WebPage.ExecutePageHierarchy()

       at System.Web.WebPages.WebPageBase.ExecutePageHierarchy(WebPageContext pageContext, TextWriter writer, WebPageRenderingBase startPage)

       at umbraco.MacroEngines.RazorMacroEngine.ExecuteRazor(MacroModel macro, INode currentPage)

       at umbraco.MacroEngines.RazorMacroEngine.Execute(MacroModel macro, INode currentPage)

       at umbraco.macro.loadMacroScript(MacroModel macro)

       at umbraco.macro.renderMacro(Hashtable pageElements, Int32 pageId)

    2014-05-08 00:00:14,103 [150] WARN  Umbraco.Web.Routing.NiceUrlProvider - [Thread 113] Couldn't find any page with nodeId=0. This is most likely caused by the page not being published.
    2014-05-08 00:00:14,119 [150] WARN  Umbraco.Web.Routing.NiceUrlProvider - [Thread 113] Couldn't find any page with nodeId=0. This is most likely caused by the page not being published.
    2014-05-08 00:00:14,119 [150] WARN  Umbraco.Web.Routing.NiceUrlProvider - [Thread 113] Couldn't find any page with nodeId=0. This is most likely caused by the page not being published.
    2014-05-08 00:00:14,134 [150] WARN  Umbraco.Web.Routing.NiceUrlProvider - [Thread 113] Couldn't find any page with nodeId=0. This is most likely caused by the page not being published.
    2014-05-08 00:00:14,134 [150] WARN  Umbraco.Web.Routing.NiceUrlProvider - [Thread 113] Couldn't find any page with nodeId=0. This is most likely caused by the page not being published.
    2014-05-08 00:00:14,150 [150] WARN  Umbraco.Web.Routing.NiceUrlProvider - [Thread 113] Couldn't find any page with nodeId=0. This is most likely caused by the page not being published.
    2014-05-08 00:00:14,150 [150] WARN  Umbraco.Web.Routing.NiceUrlProvider - [Thread 113] Couldn't find any page with nodeId=0. This is most likely caused by the page not being published.
  • Jan Skovgaard 11280 posts 23678 karma points MVP 11x admin c-trib
    May 08, 2014 @ 15:05
    Jan Skovgaard
    0

    Hi Fuji

    Could you double check that your permissions on your server has been setup correctly? There must be something weird going on there.

    Do you see this issue on your local environment?

    /Jan

  • Fuji Kusaka 2203 posts 4220 karma points
    May 08, 2014 @ 15:09
    Fuji Kusaka
    0

    No. We dont have this issue on local environment. 

    But this is really weird, once i republish all my nodes it works fine for sometime.

  • Jan Skovgaard 11280 posts 23678 karma points MVP 11x admin c-trib
    May 08, 2014 @ 15:11
    Jan Skovgaard
    0

    Hi Fuji

    Yup, really weird issue. And since you don't have the issue locally something must be wrong on the server.

    Is it a dedicated server that you control yourself or is it hosted on shared hosting?

    /Jan

  • Fuji Kusaka 2203 posts 4220 karma points
    May 09, 2014 @ 18:04
    Fuji Kusaka
    0

    Hi Jan,

    It is a dedicated server controlled by another company, but we have 12 website runing on this server but this is the only one giving us this error. 

    Any suggestions ?

  • Jan Skovgaard 11280 posts 23678 karma points MVP 11x admin c-trib
    May 09, 2014 @ 19:34
    Jan Skovgaard
    0

    Hi Fuji

    Well...It's hard to figure out what is wrong...but have you checked the setup on the server then? Has permissions been set properly? Could you compare with one of the working sites to see if something is different with this in particular site?

    /Jan

  • Fuji Kusaka 2203 posts 4220 karma points
    May 23, 2014 @ 12:26
    Fuji Kusaka
    0

    Hi Jan,

    When you speak about permissions what permissions do you think i need to check ? If permissions is not properly set would i be able to login on the back end ? 

    //fuji

  • Jan Skovgaard 11280 posts 23678 karma points MVP 11x admin c-trib
    May 23, 2014 @ 15:52
    Jan Skovgaard
    0

    Hi Fuji

    If permissions have not been set properly then yes you would be able to login to the backoffice but some parts will not work if the permissions have not been inherited to all files and folders.

    There is a list here http://our.umbraco.org/documentation/Installation/permissions

    Would I would do is to ensure that the network service and the iusr has sufficient permissions from the root folder of your Umbraco installation and that it's inherited all the way down.

    Hope this helps.

    /Jan

Please Sign in or register to post replies

Write your reply to:

Draft