Press Ctrl / CMD + C to copy this to your clipboard.
This post will be reported to the moderators as potential spam to be looked at
I have a listing page I want to pick up the image from the block editor which I am using as a header section on the top of every page.
I have the following code
var childBlocks = child.Value<IEnumerable<BlockListItem>>("blocks").Take(1);
var test = child.Name;
foreach (var block in childBlocks)
var content = block.Content;
var settings = block.Settings;
var myimageUrl = "";
if (settings.Value("Image") != null)
myimageUrl = settings.Value<IPublishedContent>("Image").Url();
if (myimageUrl != "")
<img src="@myimageUrl" alt="@child.Name" />
Which pretty much picks up the image and outputs it on the listing page. However when I update the image on the page its still picking up the old image - any ideas how to always pick up the latest image?
Or a better way to do this?
I think this is a bit of a bug, but I bet you could work around it like this:
var myImage = settings.Value<IPublishedContent>("Image");
// get the picked image 'again' from cache
var myPossiblyUpdatedImage = Umbraco.Media(myImage.Id);
myImageUrl = myPossiblyUpdatedImage.Url();
be interested to know if that works for you?
is working on a reply...
Write your reply to:
Image will be uploaded when post is submitted