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 guys,
I just upgraded to 2.0 and I'm wondering how I can convert my old code. I'm struggeling getting the first image, here's my old code:
/* First image */ var imageIds = CurrentPage.productImages.Split(new string[] { "," }, StringSplitOptions.RemoveEmptyEntries); var images = Umbraco.Media(imageIds); var firstImage = images.FirstOrDefault(); var firstImageUrl = firstImage.Url; var firstImageCropUrl = firstImage.GetResponsiveImageUrl(433, 0); <img src="@firstImageCropUrl" alt="@firstImage.GetPropertyValue("altText")" title="@CurrentPage.GetPropertyValue("pageDescription")" />
I can't seem to figure out how I could use the example from the documentation:
<img src="@Url.GetCropUrl(featureImage, 270, 161, quality:30, furtherOptions:"&format=auto")" data-srcset="@Url.GetSrcSetUrls(featureImage, 270, 161)" data-src="@Url.GetCropUrl(featureImage, 270, 161)" sizes="auto" class="lazyload" />
Any help is greatly appreciated.
// Mike
Hi Mike,
I'm sorry I missed the notification for your issue, did you manage to work it out?
Jeavon
No worries Jeavon! I did in fact not solve it, I ended up dotting my way to the image path and displaying the full dimension. Bad practice, I know.. But width is set with CSS.
is working on a reply...
Write your reply to:
Upload image
Image will be uploaded when post is submitted
Getting first image of collection
Hi guys,
I just upgraded to 2.0 and I'm wondering how I can convert my old code. I'm struggeling getting the first image, here's my old code:
I can't seem to figure out how I could use the example from the documentation:
Any help is greatly appreciated.
// Mike
Hi Mike,
I'm sorry I missed the notification for your issue, did you manage to work it out?
Jeavon
No worries Jeavon! I did in fact not solve it, I ended up dotting my way to the image path and displaying the full dimension. Bad practice, I know.. But width is set with CSS.
is working on a reply...