Copied to clipboard

Flag this post as spam?

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


  • Steffan Nicholson 6 posts 56 karma points
    Oct 28, 2014 @ 17:31
    Steffan Nicholson
    0

    Media markup vanished from rendered page

    After uploading a couple of images to a media library, one to replace another used by a couple of pages – and updating that page's properties to reference the new image: the new image, previous image, and two other images used across a couple of other pages have stopped being included in the rendered markup (even if the image datatype fields are refreshed or a database backup restored). Nothing, Nada, Zip, Zilch – just a gap in the markup and nothing obvious in the trace.

    Anyone experience anything similar or have any thoughts?

    Request Details

    Session Id: jw34rap3auwz2divyb1dld4k Request Type: GET
    Time of Request: 28/10/2014 16:18:12 Status Code: 200
    Request Encoding: Unicode (UTF-8) Response Encoding: Unicode (UTF-8)

    Trace Information

    CategoryMessageFrom First(s)From Last(s)
    aspx.page Begin PreInit    
    aspx.page End PreInit 0.000909 0.000909
    aspx.page Begin Init 0.000930 0.000021
    renderMacro Rendering started (macro: Page Title, type: 6, cacheRate: 0) 0.000975 0.000045
    umbracoMacro MacroEngine script added (PageTitle.cshtml) 0.001013 0.000038
    umbracoMacro Loading IMacroEngine script 0.001032 0.000019
    umbracoMacro Loading Macro Script Context (file: Page Title) 0.001492 0.000460
    umbracoMacro Loading Macro Script Context (file: Page Title) 0.001513 0.000022
    umbracoMacro Done Loading Macro Script Context (file: Page Title) 0.001532 0.000018
    umbracoMacro Boxing Macro Script MacroContext (file: Page Title) 0.001549 0.000018
    umbracoMacro Done Boxing Macro Script MacroContext (file: Page Title) 0.001570 0.000021
    umbracoMacro Loading Macro Script Model (file: Page Title) 0.001588 0.000018
    umbracoMacro Done Loading Macro Script Model (file: Page Title) 0.001616 0.000028
    umbracoMacro Done Loading Macro Script Context (file: Page Title) 0.001634 0.000018
    umbracoMacro Executing Macro Script (file: Page Title) 0.001653 0.000019
    umbracoMacro Done Executing Macro Script (file: Page Title) 0.002733 0.001080
    umbracoMacro Loading IMacroEngine script [done] 0.002755 0.000022
    renderMacro Rendering started (macro: Header Tags, type: 6, cacheRate: 60) 0.002795 0.000040
    renderMacro Macro Content loaded from cache 'HeaderTags-1075-'. 0.006306 0.003511
    renderMacro Rendering started (macro: Navigation, type: 6, cacheRate: 60) 0.006351 0.000045
    renderMacro Macro Content loaded from cache 'Navigation-1075-'. 0.006446 0.000095
    renderMacro Rendering started (macro: Search Box, type: 6, cacheRate: 0) 0.006489 0.000043
    umbracoMacro MacroEngine script added (SearchBox.cshtml) 0.006513 0.000024
    umbracoMacro Loading IMacroEngine script 0.006531 0.000018
    umbracoMacro Loading Macro Script Context (file: Search Box) 0.006976 0.000445
    umbracoMacro Loading Macro Script Context (file: Search Box) 0.006997 0.000021
    umbracoMacro Done Loading Macro Script Context (file: Search Box) 0.007016 0.000019
    umbracoMacro Boxing Macro Script MacroContext (file: Search Box) 0.007033 0.000017
    umbracoMacro Done Boxing Macro Script MacroContext (file: Search Box) 0.007054 0.000021
    umbracoMacro Loading Macro Script Model (file: Search Box) 0.007072 0.000018
    umbracoMacro Done Loading Macro Script Model (file: Search Box) 0.007097 0.000025
    umbracoMacro Done Loading Macro Script Context (file: Search Box) 0.007116 0.000018
    umbracoMacro Executing Macro Script (file: Search Box) 0.007136 0.000021
    umbracoMacro Done Executing Macro Script (file: Search Box) 0.017705 0.010569
    umbracoMacro Loading IMacroEngine script [done] 0.017745 0.000040
    renderMacro Rendering started (macro: Display Image, type: 6, cacheRate: 0) 0.017825 0.000081
    umbracoMacro MacroEngine script added (DisplayImage.cshtml) 0.017856 0.000031
    umbracoMacro Loading IMacroEngine script 0.017874 0.000018
    umbracoMacro Loading Macro Script Context (file: Display Image) 0.018383 0.000509
    umbracoMacro Loading Macro Script Context (file: Display Image) 0.018404 0.000021
    umbracoMacro Done Loading Macro Script Context (file: Display Image) 0.018423 0.000019
    umbracoMacro Boxing Macro Script MacroContext (file: Display Image) 0.018440 0.000017
    umbracoMacro Done Boxing Macro Script MacroContext (file: Display Image) 0.018458 0.000018
    umbracoMacro Loading Macro Script Model (file: Display Image) 0.018475 0.000017
    umbracoMacro Done Loading Macro Script Model (file: Display Image) 0.018504 0.000029
    umbracoMacro Done Loading Macro Script Context (file: Display Image) 0.018523 0.000019
    umbracoMacro Executing Macro Script (file: Display Image) 0.018542 0.000019
    umbracoMacro Done Executing Macro Script (file: Display Image) 0.032582 0.014039
    umbracoMacro Loading IMacroEngine script [done] 0.032619 0.000037
    renderMacro Rendering started (macro: Latest news, type: 6, cacheRate: 600) 0.032677 0.000058
    renderMacro Macro Content loaded from cache 'LatestNews-1075-'. 0.032811 0.000133
    renderMacro Rendering started (macro: Get In Touch, type: 6, cacheRate: 600) 0.032851 0.000040
    renderMacro Macro Content loaded from cache 'GetInTouch-1075-'. 0.032938 0.000088
    renderMacro Rendering started (macro: Related Links, type: 6, cacheRate: 600) 0.032978 0.000040
    renderMacro Macro Content loaded from cache 'RelatedLinks-1075-'. 0.033065 0.000087
    renderMacro Rendering started (macro: Language Selector, type: 6, cacheRate: 600) 0.033104 0.000038
    renderMacro Macro Content loaded from cache 'LanguageSelector-1075-'. 0.033190 0.000087
    renderMacro Rendering started (macro: Social Links, type: 6, cacheRate: 60) 0.033229 0.000039
    renderMacro Macro Content loaded from cache 'SocialLinks-1075-'. 0.033311 0.000082
    aspx.page End Init 0.033358 0.000047
    aspx.page Begin InitComplete 0.033377 0.000019
    aspx.page End InitComplete 0.033394 0.000017
    aspx.page Begin PreLoad 0.033410 0.000016
    aspx.page End PreLoad 0.033427 0.000017
    aspx.page Begin Load 0.033450 0.000024
    item.recursive Item loaded from 1075 0.033737 0.000287
    item Start parsing 'siteName' 0.033759 0.000021
    item Done parsing 'siteName' 0.033799 0.000040
    item Start parsing 'headerText' 0.033831 0.000033
    item Done parsing 'headerText' 0.033867 0.000036
    item Start parsing 'bodyText' 0.033904 0.000036
    item Done parsing 'bodyText' 0.033938 0.000035
    aspx.page End Load 0.033982 0.000043
    aspx.page Begin LoadComplete 0.034000 0.000018
    aspx.page End LoadComplete 0.034016 0.000017
    aspx.page Begin PreRender 0.034033 0.000016
    aspx.page End PreRender 0.034055 0.000022
    aspx.page Begin PreRenderComplete 0.034080 0.000025
    aspx.page End PreRenderComplete 0.034097 0.000018
    aspx.page Begin SaveState 0.035007 0.000909
    aspx.page End SaveState 0.035025 0.000018
    aspx.page Begin SaveStateComplete 0.035041 0.000016
    aspx.page End SaveStateComplete 0.035061 0.000021
    aspx.page Begin Render 0.035078 0.000016
    aspx.page End Render 0.036191 0.001114

    Control Tree

    Control UniqueIDTypeRender Size Bytes (including children)ViewState Size Bytes (excluding children)ControlState Size Bytes (excluding children)
    __Page ASP.default_aspx 6754 0 0
        ctl00 ASP.masterpages_public_homepage_master 0 0 0
            ctl00$ctl00 ASP.masterpages_public_master 0 0 0
                ctl00$ctl00$ctl00 umbraco.presentation.templateControls.Macro 0 0 0
                    ctl00$ctl00$ctl05 System.Web.UI.LiteralControl 0 0 0
                ctl00$ctl00$ctl01 umbraco.presentation.templateControls.Macro 0 0 0
                    ctl00$ctl00$ctl06 System.Web.UI.LiteralControl 0 0 0
                ctl00$ctl00$ctl02 umbraco.presentation.templateControls.Item 0 0 0
                    ctl00$ctl00$ctl02$ctl00 System.Web.UI.LiteralControl 0 0 0
                ctl00$ctl00$ctl03 umbraco.presentation.templateControls.Macro 0 0 0
                    ctl00$ctl00$ctl07 System.Web.UI.LiteralControl 0 0 0
                ctl00$ctl00$ctl04 umbraco.presentation.templateControls.Macro 0 0 0
                    ctl00$ctl00$ctl08 System.Web.UI.LiteralControl 0 0 0
                ctl00$ctl00$HeaderContent System.Web.UI.WebControls.ContentPlaceHolder 0 0 0
                    ctl00$ctl00$HeaderContent$ctl01 System.Web.UI.LiteralControl 0 0 0
                    ctl00$ctl00$HeaderContent$ctl00 umbraco.presentation.templateControls.Item 0 0 0
                        ctl00$ctl00$HeaderContent$ctl00$ctl00 System.Web.UI.LiteralControl 0 0 0
                    ctl00$ctl00$HeaderContent$ctl02 System.Web.UI.LiteralControl 0 0 0
                ctl00$ctl00$MainContent System.Web.UI.WebControls.ContentPlaceHolder 0 0 0
                    ctl00$ctl00$MainContent$ctl02 System.Web.UI.LiteralControl 0 0 0
                    ctl00$ctl00$MainContent$ctl00 umbraco.presentation.templateControls.Macro 0 0 0
                        ctl00$ctl00$MainContent$ctl03 System.Web.UI.LiteralControl 0 0 0
                    ctl00$ctl00$MainContent$ctl04 System.Web.UI.LiteralControl 0 0 0
                    ctl00$ctl00$MainContent$ctl01 umbraco.presentation.templateControls.Item 0 0 0
                        ctl00$ctl00$MainContent$ctl01$ctl00 System.Web.UI.LiteralControl 0 0 0
                    ctl00$ctl00$MainContent$ctl05 System.Web.UI.LiteralControl 0 0 0
                ctl00$ctl00$SideContent System.Web.UI.WebControls.ContentPlaceHolder 0 0 0
                    ctl00$ctl00$SideContent$ctl02 System.Web.UI.LiteralControl 0 0 0
                    ctl00$ctl00$SideContent$ctl00 umbraco.presentation.templateControls.Macro 0 0 0
                        ctl00$ctl00$SideContent$ctl03 System.Web.UI.LiteralControl 0 0 0
                    ctl00$ctl00$SideContent$ctl04 System.Web.UI.LiteralControl 0 0 0
                    ctl00$ctl00$SideContent$ctl01 umbraco.presentation.templateControls.Macro 0 0 0
                        ctl00$ctl00$SideContent$ctl05 System.Web.UI.LiteralControl 0 0 0
                    ctl00$ctl00$SideContent$ctl06 System.Web.UI.LiteralControl 0 0 0
                ctl00$ctl00$Macro1 umbraco.presentation.templateControls.Macro 0 0 0
                    ctl00$ctl00$ctl09 System.Web.UI.LiteralControl 0 0 0
                ctl00$ctl00$Macro2 umbraco.presentation.templateControls.Macro 0 0 0
                    ctl00$ctl00$ctl10 System.Web.UI.LiteralControl 0 0 0
                ctl00$ctl00$Macro3 umbraco.presentation.templateControls.Macro 0 0 0
                    ctl00$ctl00$ctl11 System.Web.UI.LiteralControl 0 0 0

    Session State

    Session KeyTypeValue

    Application State

    Application KeyTypeValue
    Combres.Configuration.28/10/2014 16:17:59 Combres.Settings Combres.Settings

    Request Cookies Collection

    NameValueSize
    UMB_UPDCHK 1 12
    UMB_UCONTEXT 5FFC6D2C89C13CF4F3C87548C0304ACCBD1F6D3C660A542805401C58A47FA1A092A37658AEFCD2E30D08AAAFBFAB8E4B7D3F90185315B786FA534A34D79B1F12E5D6C3D83F281D3D7D990307BF47F6C2AB7E96FD4EA6013F5FDB67AF55EC2F7E5C8197AEB4D06FF400E13357F9A4BDEF701145DA18F95135421794ECF88090F7288F2F2A9D93C1BAFEB6F704B61FBEA9F6DB9D20B45387525B138320B37310DE159E80133AE9DCA83D7B49518A7130239A7C8CF2BB9F172EE3C34008A3610042 397
    ASP.NET_SessionId jw34rap3auwz2divyb1dld4k 42

    Response Cookies Collection

    NameValueSize

    Headers Collection

    NameValue
    Connection keep-alive
    Accept text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
    Accept-Encoding gzip, deflate
    Accept-Language en-GB,en;q=0.5
    Cookie UMB_UPDCHK=1; UMB_UCONTEXT=5FFC6D2C89C13CF4F3C87548C0304ACCBD1F6D3C660A542805401C58A47FA1A092A37658AEFCD2E30D08AAAFBFAB8E4B7D3F90185315B786FA534A34D79B1F12E5D6C3D83F281D3D7D990307BF47F6C2AB7E96FD4EA6013F5FDB67AF55EC2F7E5C8197AEB4D06FF400E13357F9A4BDEF701145DA18F95135421794ECF88090F7288F2F2A9D93C1BAFEB6F704B61FBEA9F6DB9D20B45387525B138320B37310DE159E80133AE9DCA83D7B49518A7130239A7C8CF2BB9F172EE3C34008A3610042; ASP.NET_SessionId=jw34rap3auwz2divyb1dld4k
    Host ************.***
    User-Agent Mozilla/5.0 (Windows NT 6.3; WOW64; rv:32.0) Gecko/20100101 Firefox/32.0

    Response Headers Collection

    NameValue
    Cache-Control private
    Content-Type text/html

    Form Collection

    NameValue

    Querystring Collection

    NameValue
    umbDebugShowTrace true

    Server Variables

    NameValue
    ALL_HTTP HTTP_CONNECTION:keep-alive HTTP_ACCEPT:text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8 HTTP_ACCEPT_ENCODING:gzip, deflate HTTP_ACCEPT_LANGUAGE:en-GB,en;q=0.5 HTTP_COOKIE:UMB_UPDCHK=1; UMB_UCONTEXT=5FFC6D2C89C13CF4F3C87548C0304ACCBD1F6D3C660A542805401C58A47FA1A092A37658AEFCD2E30D08AAAFBFAB8E4B7D3F90185315B786FA534A34D79B1F12E5D6C3D83F281D3D7D990307BF47F6C2AB7E96FD4EA6013F5FDB67AF55EC2F7E5C8197AEB4D06FF400E13357F9A4BDEF701145DA18F95135421794ECF88090F7288F2F2A9D93C1BAFEB6F704B61FBEA9F6DB9D20B45387525B138320B37310DE159E80133AE9DCA83D7B49518A7130239A7C8CF2BB9F172EE3C34008A3610042; ASP.NET_SessionId=jw34rap3auwz2divyb1dld4k HTTP_HOST:************.*** HTTP_USER_AGENT:Mozilla/5.0 (Windows NT 6.3; WOW64; rv:32.0) Gecko/20100101 Firefox/32.0
    ALL_RAW Connection: keep-alive Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8 Accept-Encoding: gzip, deflate Accept-Language: en-GB,en;q=0.5 Cookie: UMB_UPDCHK=1; UMB_UCONTEXT=5FFC6D2C89C13CF4F3C87548C0304ACCBD1F6D3C660A542805401C58A47FA1A092A37658AEFCD2E30D08AAAFBFAB8E4B7D3F90185315B786FA534A34D79B1F12E5D6C3D83F281D3D7D990307BF47F6C2AB7E96FD4EA6013F5FDB67AF55EC2F7E5C8197AEB4D06FF400E13357F9A4BDEF701145DA18F95135421794ECF88090F7288F2F2A9D93C1BAFEB6F704B61FBEA9F6DB9D20B45387525B138320B37310DE159E80133AE9DCA83D7B49518A7130239A7C8CF2BB9F172EE3C34008A3610042; ASP.NET_SessionId=jw34rap3auwz2divyb1dld4k Host: ************.*** User-Agent: Mozilla/5.0 (Windows NT 6.3; WOW64; rv:32.0) Gecko/20100101 Firefox/32.0
    APPL_MD_PATH /LM/W3SVC/**/ROOT
    APPL_PHYSICAL_PATH *:\*******\************\************.***\
    AUTH_TYPE  
    AUTH_USER  
    AUTH_PASSWORD  
    LOGON_USER  
    REMOTE_USER  
    CERT_COOKIE  
    CERT_FLAGS  
    CERT_ISSUER  
    CERT_KEYSIZE  
    CERT_SECRETKEYSIZE  
    CERT_SERIALNUMBER  
    CERT_SERVER_ISSUER  
    CERT_SERVER_SUBJECT  
    CERT_SUBJECT  
    CONTENT_LENGTH 0
    CONTENT_TYPE  
    GATEWAY_INTERFACE CGI/1.1
    HTTPS off
    HTTPS_KEYSIZE  
    HTTPS_SECRETKEYSIZE  
    HTTPS_SERVER_ISSUER  
    HTTPS_SERVER_SUBJECT  
    INSTANCE_ID **
    INSTANCE_META_PATH /LM/W3SVC/**
    LOCAL_ADDR ***.***.***.***
    PATH_INFO /default.aspx
    PATH_TRANSLATED *:\*******\************\************.***\default.aspx
    QUERY_STRING umbDebugShowTrace=true
    REMOTE_ADDR ***.***.***.***
    REMOTE_HOST ***.***.***.***
    REMOTE_PORT 49341
    REQUEST_METHOD GET
    SCRIPT_NAME /default.aspx
    SERVER_NAME ************.***
    SERVER_PORT 80
    SERVER_PORT_SECURE 0
    SERVER_PROTOCOL HTTP/1.1
    SERVER_SOFTWARE Microsoft-IIS/8.5    (that's on Server 2012R2)
    URL /default.aspx
    HTTP_CONNECTION keep-alive
    HTTP_ACCEPT text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
    HTTP_ACCEPT_ENCODING gzip, deflate
    HTTP_ACCEPT_LANGUAGE en-GB,en;q=0.5
    HTTP_COOKIE UMB_UPDCHK=1; UMB_UCONTEXT=5FFC6D2C89C13CF4F3C87548C0304ACCBD1F6D3C660A542805401C58A47FA1A092A37658AEFCD2E30D08AAAFBFAB8E4B7D3F90185315B786FA534A34D79B1F12E5D6C3D83F281D3D7D990307BF47F6C2AB7E96FD4EA6013F5FDB67AF55EC2F7E5C8197AEB4D06FF400E13357F9A4BDEF701145DA18F95135421794ECF88090F7288F2F2A9D93C1BAFEB6F704B61FBEA9F6DB9D20B45387525B138320B37310DE159E80133AE9DCA83D7B49518A7130239A7C8CF2BB9F172EE3C34008A3610042; ASP.NET_SessionId=jw34rap3auwz2divyb1dld4k
    HTTP_HOST ************.***
    HTTP_USER_AGENT Mozilla/5.0 (Windows NT 6.3; WOW64; rv:32.0) Gecko/20100101 Firefox/32.0

    Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.0.30319.34212

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

    Hi Steffan and welcome to our :)

    1. What version of Umbraco are you using?
    2. What does the code your using to fetch the images look like?
    3. What is the type of image you're uploading? (.jpg,.jpeg,.png,.gif etc.)
    4. What is the image size in terms of kb/mb?

    /Jan

  • Steffan Nicholson 6 posts 56 karma points
    Oct 29, 2014 @ 12:57
    Steffan Nicholson
    0

    Hi Jan

    1. Sorry, I lost the opening line when I copied across the draft of my post – Umbraco v6.0.6 (Assembly version: 1.0.4898.16909).

    2. See below after the other answers...

    3. I stupidly hadn't realised that all the affected images are PNGs – like I said the images have all been successfully uploaded and two of them used to render just fine though but now that I realise they're all PNGs I've tried substituting a JPG for one of them and it worked fine.

    4. I am not sure how this could play into this as two of the images used to render, there are much larger images that still render (albeit JPEGs), and it's the markup that is missing – while the images requested directly by the src that should be generate appear with no problem). But in answer to your question: 36 KB, 51.5 KB, and 124.4 KB.

    The problem (after further investigation) is with the block highlighted in red (in the third code block below) that aborts further processing if media.UmbracoFile is found to be Null or Empty.

    Having checked cmsContentXml for all of the PNGs, they all have the appropriate umbracoFile node so I'm at a loss as to why the paths for these have suddenly stopped being processed at this point in their handling.

    One affected page has the following template:

    <%@ Master Language="C#" MasterPageFile="~/masterpages/Public.master" %>

    <asp:content ContentPlaceHolderId="HeaderContent" runat="server">
        <h2><umbraco:Item field="headerText" stripParagraph="true" runat="server" /></h2>
    </asp:content>
    <asp:content ContentPlaceHolderId="MainContent" runat="server">
        <div class="row">
            <div class="span4">
                <umbraco:Macro Alias="DisplayImage" MediaId="[#bodyImage]" ImageWidth="340" runat="server" />
            </div>
            <div class="span4">
                <umbraco:Item Field="bodyText" runat="server" />
            </div>
        </div>
    </asp:content>
    <asp:content ContentPlaceHolderID="SideContent" runat="server">
        <umbraco:Macro Alias="LatestNews" runat="server" />
        <umbraco:Macro Alias="GetInTouch" runat="server" />
    </asp:content>

    With the highlighted Macro (DisplayImage.cshtml) being:

    @*
    Paramaters:
    MediaId (mandatory)
    ImageWidth (int, mandatory)
    ImageHeight (optional)
    Constrain (optional. Only works if ImageHeight has been set)
    BgColor (optional. Only works if ImageHeight. Ignores the constrain and sets the the pad value to true
    AltText (optional, gets media name by default)
    ImageClass (optional, sets the css class to an image)
    FloatImage (bool, optional, floats the image)
    *@
    @using umbraco.MacroEngines
    @inherits DynamicNodeContext
    @{
    int mediaId;
    if (!int.TryParse(Parameter.MediaId, out mediaId))
    {
    return;
    }

    bool floatImage;
    bool.TryParse(Parameter.FloatImage, out floatImage);
    if (floatImage)
    {
    <div class="floatImage">
    @RenderPage("ResizeImage.cshtml", Parameter.MediaId, Parameter.ImageWidth, Parameter.ImageHeight, Parameter.Constrain, Parameter.BgColor, Parameter.AltText, Parameter.ImageClass)
    </div>
    }
    else
    {
    @RenderPage("ResizeImage.cshtml", Parameter.MediaId, Parameter.ImageWidth, Parameter.ImageHeight, Parameter.Constrain, Parameter.BgColor, Parameter.AltText, Parameter.ImageClass)
    }
    }

    Which in turn calls (ResizeImage.cshtml):

    @*
    Paramaters:
    MediaId (mandatory)
    ImageWidth (mandatory)
    ImageHeight (optional)
    Constrain (optional. Only works if ImageHeight has been set)
    BgColor (optional. Only works if ImageHeight. Ignores the constrain and sets the the pad value to true
    AltText (optional, gets media name by default)
    ImageClass (optional, sets the css class to an image)
    *@

    @using System.Collections.Specialized
    @using Bootstrap.Logic.Utils
    @using umbraco.MacroEngines
    @inherits DynamicNodeContext
    @{
    int mediaId;
    if(!int.TryParse(PageData[0], out mediaId))
    {
    return;
    }

    var nvc = new NameValueCollection();
    var media = Library.MediaById(mediaId);
    if (media == null || media.NodeTypeAlias != "Image")
    {
    return;
    }

    string mediaPath = media.UmbracoFile;
    if (string.IsNullOrEmpty(mediaPath))
    {
    return;
    }

    int mediaWidth = int.Parse(media.UmbracoWidth.ToString());
    int mediaHeight = int.Parse(media.UmbracoHeight.ToString());
    int newWidth = int.Parse(PageData[1]);
    int newHeight;
    if (newWidth < mediaWidth)
    {
    newHeight = newWidth * mediaHeight / mediaWidth;
    }
    else
    {
    newWidth = mediaWidth;
    newHeight = mediaHeight;
    }
    int maxHeight;
    if (int.TryParse(PageData[2], out maxHeight))
    {
    bool constrain;
    if (bool.TryParse(PageData[3], out constrain))
    {
    if (constrain)
    {
    nvc.Add("constrain", "true");
    if (newHeight > maxHeight)
    {
    newWidth = maxHeight * mediaWidth / mediaHeight;
    newHeight = maxHeight;
    }
    }
    else
    {
    nvc.Add("constrain", "false");
    newWidth = int.Parse(PageData[1]);
    newHeight = int.Parse(PageData[2]);
    }
    }

    if(!string.IsNullOrEmpty(PageData[4]))
    {
    // Ignore constrain
    newWidth = int.Parse(PageData[1]);
    newHeight = int.Parse(PageData[2]);
    nvc.Remove("constrain");
    nvc.Add("pad", "true");
    nvc.Add("bgcolor", PageData[4]);
    }

    nvc.Add("width", newWidth.ToString());
    nvc.Add("height", newHeight.ToString());
    }
    else
    {
    nvc.Add("width", newWidth.ToString());
    }

    var query = nvc.ConstructQueryString();

    string mediaName = string.IsNullOrEmpty(PageData[5]) ? media.Name : PageData[5];
    string imageClass = !string.IsNullOrEmpty(PageData[6]) ? string.Format(" class=\"{0}\"", PageData[6]) : string.Empty;
    <img src="/ImageGen.ashx?image=@mediaPath&amp;@query" width="@newWidth" height="@newHeight" alt="@mediaName"@Html.Raw(imageClass) />
    }

    No point going as far as the code for ImageGen.ashx as (as already pointed out) the images load just fine when access via the address bar and it's the actual markup that's missing (for PNGs only, though only since Monday) and because the umbracoFile details are not being read for PNGs.

    Thanks in advance for any help you can offer.

  • Steffan Nicholson 6 posts 56 karma points
    Oct 29, 2014 @ 13:10
    Steffan Nicholson
    0

    Sorry, didn't realise the code would get parsed and styled and thereby lose the styling I'd added.

    The problem occurs when the third file reaches this block:

        string mediaPath = media.UmbracoFile;
       
    if(string.IsNullOrEmpty(mediaPath))
       
    {
           
    return;
       
    }
  • Steffan Nicholson 6 posts 56 karma points
    Oct 30, 2014 @ 14:09
    Steffan Nicholson
    101

    Not to worry, the solution (although it had been attempted without luck already) was to rebuild the indexes.

  • Jan Skovgaard 11280 posts 23678 karma points MVP 11x admin c-trib
    Oct 30, 2014 @ 17:21
    Jan Skovgaard
    0

    Hi Steffan

    Sorry for the late reply - Happy that you found the soltuon and thanks for sharing :)

    /Jan

Please Sign in or register to post replies

Write your reply to:

Draft