Take the community feedback survey now.

Using PropertyFor for unpublished image still renders the image

Vote:
 

Hi!

We are using PropertyFor to render an image:

@Html.PropertyFor(x => x.CurrentPage.Image)

but even though the image is not published it gets rendered, is that ok? The same image in a Tiny MCE editor shows a missing image.

What is the correct way of doing it so that the image is only rendered if it is published?

Thanks!

/Kristoffer

#340116
Aug 26, 2025 14:19
Vote:
 

Hi Kristoffer,

images are automatically published as soon as they are uploaded to CMS so you can use them immediately. You can control visibility using expiration feature or by setting published date in the future, scheduled publish. 

Now the question is why TinyMCE shows missing image. Is image missing while editing content in TinyMCE or when viewing the page? What happens with TinyMCE property when you change focus to another editable field on the same page? Are you editing from the on-page editor or using all properties view? Custom rendering of XHtml property or using display template?

In my case image is always shown, maybe there is some TinyMCE plugin involved or the way you add an image, by using TinyMCE icon from the toolbar or by using drag-drop from the assets pane.

Hope this helps you in further investigation.

Best regards,
Milos

#340148
Aug 29, 2025 16:37
Vote:
 

Hi!

We have a mandatory property on our images which makes all uploaded images unpublished so it is a bit strange that the image shows with the PropertyFor since it never has been published. Tiny is handling it correct.

I'll try to investigate some more. 

/Kristoffer

#340155
Aug 30, 2025 13:31
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.