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
Hi, I changed the Media Picker data type from (Obsolete) Media Picker to Umbraco.MemberPicker2 and now images no longer display on my website.
This is my code to display image:
@inherits Umbraco.Web.Macros.PartialViewMacroPage @{ if(CurrentPage.HasValue("articleImg")){ string w = (string)Umbraco.Media(CurrentPage.articleImg).umbracoWidth; string h = (string)Umbraco.Media(CurrentPage.articleImg).umbracoHeight; int imgWidth = w.AsInt(); if (imgWidth > 1500) { <div class="col-xl-12" class="news-page-img-container"> <img src="@Umbraco.Media(CurrentPage.articleImg).Url" alt="@CurrentPage.photoAlt" class="news-img" /> </div> } else { <div class="col-xl-2 col-lg-2 col-md-2"> </div> <div class="col-xl-8 col-lg-8 col-md-8"> <img src="@Umbraco.Media(CurrentPage.articleImg).Url" alt="@CurrentPage.photoAlt" class="img-fluid" /> </div> <div class="col-xl-2 col-lg-2 col-md-2"> </div> } }
Any idea why images no longer display? (even after pick them again)
Thanks
Ok, I figured out and resolved the issue. I only had to add to each @Umbraco.Media .ToString()
@Umbraco.Media
.ToString()
@Umbraco.Media(CurrentPage.articleImg.ToString()).Url
I guess is because the new media picker 2 uses udi which is string and not int ?
Anyway it works for me
Thanks also for this answer:
https://stackoverflow.com/questions/37941476/umbraco-how-to-display-an-image-from-a-media-picker-in-the-src-of-an-img-tag
is working on a reply...
Write your reply to:
Upload image
Image will be uploaded when post is submitted
Image not display after change (Obsolete) Media Picker to Umbraco.MemberPicker2
Hi, I changed the Media Picker data type from (Obsolete) Media Picker to Umbraco.MemberPicker2 and now images no longer display on my website.
This is my code to display image:
Any idea why images no longer display? (even after pick them again)
Thanks
Ok, I figured out and resolved the issue. I only had to add to each
@Umbraco.Media
.ToString()
I guess is because the new media picker 2 uses udi which is string and not int ?
Anyway it works for me
Thanks also for this answer:
https://stackoverflow.com/questions/37941476/umbraco-how-to-display-an-image-from-a-media-picker-in-the-src-of-an-img-tag
is working on a reply...