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
hey guys,
following scenario:
within my home view I'm trying to pass the crop url to the partial view:
@inherits Umbraco.Web.Mvc.UmbracoViewPage<Home> @using ProFinder.Core.ViewModels @{ Layout = "master.cshtml"; } @Html.Partial("~/Views/Partials/header.cshtml", new HeaderViewModel(Model.Name, Model.Title, Model.Subtitle, Model.MainImage.GetCropUrl("hero")))
Model.MainImage is an "ImageCropperValue" within the namespace Umbraco.Core.PropertyEditors.ValueConverters
My ViewModell:
public class HeaderViewModel { public string Name { get; set; } public string Title { get; set; } public string Subtitle { get; set; } public bool HasSubtitle => !string.IsNullOrWhiteSpace(Subtitle); public string BackgroundImageUrl { get; set; } public bool HasBackgroundImage => string.IsNullOrEmpty(BackgroundImageUrl); public string AuthorName { get; set; } public bool HasAuthor => !string.IsNullOrWhiteSpace(AuthorName); public DateTime? ArticleDate { get; set; } public bool IsArticle => ArticleDate.HasValue; public HeaderViewModel(string name, string title, string subtitle, string backgroundImageUrl, string authorName = null, DateTime? articleDate = null) { Name = name; Title = title; Subtitle = subtitle; BackgroundImageUrl = backgroundImageUrl; AuthorName = authorName; ArticleDate = articleDate; } }
My PartialView:
@inherits UmbracoViewPage<ProFinder.Core.ViewModels.HeaderViewModel> @{ string mainImageUrl = Model.HasBackgroundImage ? Model.BackgroundImageUrl : "img/home_section_1.jpg"; } ... <section class="hero_single version_1" style="background-image: url('@mainImageUrl')">
Returned Url in response:
<section class="hero_single version_1" style="background-image: url('?center=0.41466666666666668,0.11833333333333333&mode=crop&width=1600&height=620')">
Which is not showing up the image.
Any ideas?
Thanks
Dee
the solution:
@Html.Partial("~/Views/Partials/header.cshtml", new HeaderViewModel(Model.Name, Model.Title, Model.Subtitle, Model.MainImage.Src + Model.MainImage.GetCropUrl("hero")))
is working on a reply...
This forum is in read-only mode while we transition to the new forum.
You can continue this topic on the new forum by tapping the "Continue discussion" link below.
Continue discussion
ImageCropperValue.GetCropUrl not providing the correct url
hey guys,
following scenario:
within my home view I'm trying to pass the crop url to the partial view:
Model.MainImage is an "ImageCropperValue" within the namespace Umbraco.Core.PropertyEditors.ValueConverters
My ViewModell:
My PartialView:
Returned Url in response:
Which is not showing up the image.
Any ideas?
Thanks
Dee
the solution:
is working on a reply...
This forum is in read-only mode while we transition to the new forum.
You can continue this topic on the new forum by tapping the "Continue discussion" link below.