Take the community feedback survey now.
Take the community feedback survey now.
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
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
Hi!
We are using PropertyFor to render an 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
For image rendering, pass the content’s reference into the Url.ContentUrl() extension method.
Thanks & Regards,
Deepmala Sharma
Thanks for your suggestion, but using the PropertyFor gives me alt text for example. Using Url.ContentUrl() will not help with that right?
No, @Url.ContentUrl() only returns the URL of the content, not the alt text.
Alternate approach we have, You can manually extract alt text with img tag.
var imageUrl = UrlResolver.GetUrl(image.ContentLink);
var altText = !string.IsNullOrEmpty(image.AltText) ? image.AltText : image.Name;