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
Category
Message
From 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)
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).
See below after the other answers...
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.
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.
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; }
@* 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]); } }
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.
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
Trace Information
Control Tree
Session State
Application State
Request Cookies Collection
Response Cookies Collection
Headers Collection
Response Headers Collection
Form Collection
Querystring Collection
Server Variables
Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.0.30319.34212
Hi Steffan and welcome to our :)
/Jan
Hi Jan
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:
With the highlighted Macro (DisplayImage.cshtml) being:
Which in turn calls (ResizeImage.cshtml):
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.
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:
Not to worry, the solution (although it had been attempted without luck already) was to rebuild the indexes.
Hi Steffan
Sorry for the late reply - Happy that you found the soltuon and thanks for sharing :)
/Jan
is working on a reply...