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
Umb V7.13.1, Slimsy V2.0
Trying to get Slimsy to do it's magic on basic RTE's. Have tried methods here: https://github.com/Jeavon/Slimsy (4 (options)) and here: http://www.jondjones.com/learn-umbraco-cms/umbraco-developers-guide/umbraco-packages/easy-responsive-images-in-umbraco-with-slimsy but neither affect the output in any way.
This is on a simple blog article page with @inherits Umbraco.Web.Mvc.UmbracoViewPage<BlogPost> Converting @Html.Raw(Model.BodyText) to @Html.ConvertImgToSrcSet(Model.BodyText.ToHtmlString(), true, true) runs but doesn't work while converting to @Html.ConvertImgToSrcSet(Model, "bodyText", true, true) doesn't run at all (cannot convert Umbraco.Web.PublishedContentModels.BlogPost to String)
@Html.ConvertImgToSrcSet(Model.BodyText.ToHtmlString(), true, true)
@Html.ConvertImgToSrcSet(Model, "bodyText", true, true)
Any advice to get this working would be appreciated.
His use of Model is correct as the view inherits from UmbracoViewPage rather than UmbracoTemplatePage. Because of this there is no need for Model.Content as Model is the correct model :-)
Are you using Slimsy v2.1.0-beta2?
Did you try (although this is obsolete in 2.1):
@Html.ConvertImgToSrcSet(Model.BodyText, true, true)
I used the current package from Nuget V2.0.0 which is the same version as the Umbraco project. Should I be using another version? The site's about to go live.
No, that's fine.
Then I think you should have
Sorry for the late reply, have only just got back to this project. Your suggestion worked fine for where the RTE was accessible directly off the the DocType, thanks.
Didn't work for the following situation, but managed to sort it with a cast:-
foreach (var chunk in (IEnumerable<IPublishedContent>)Model.ContentSections)
@Html.ConvertImgToSrcSet(chunk.GetPropertyValue("bodyText"), true, true) // Didn't work
@Html.ConvertImgToSrcSet(chunk.GetPropertyValue<IHtmlString>("bodyText"), true, true) // Works
Opening this up again as have noticed that using @Html.ConvertImgToSrcSet causes a severe loss of quality on some images. If I use @Html.Raw then the images look fine, though they're not srcset of course :(
Just wondered if there was any workaround or technique I should be aware of.
is working on a reply...
Write your reply to:
Image will be uploaded when post is submitted