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)
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 :-)
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.
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)
{
<h2>@chunk.GetPropertyValue("title")</h2>
@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.
RTE ConvertImgToSrcSet not working
Umb V7.13.1, Slimsy V2.0
Hi,
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)Any advice to get this working would be appreciated.
-Craig
Model.Content ??
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 :-)
Nik
Hi Craig,
Are you using Slimsy v2.1.0-beta2?
Did you try (although this is obsolete in 2.1):
Jeavon
Edited above
Hi Jeavon,
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.
Craig
No, that's fine.
Then I think you should have
Hi Jeavon,
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:-
Thanks
Craig
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.
Cheers,
Craig
is working on a reply...