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
I have uploaded an image to Umbraco using code.
This returns an IMedia object. Now that I have inserted the image into Umbraco I want to use the the CropUrl.
Does anyone know how to convert an IMedia to Image?
Hi Nathan,
I am not sure you need to convert to an Image. I would say you want to be converting to IPublishedContent.
You then have all the usual fields .Url, .GetCropUrl etc.
I think this is what you need.
IMedia media = "your insert code here" if(media != null) { IPublishedContent image = Umbraco.Media(media.Id); modelFromSession.CompanyLogoUrl = image.GetCropUrl("companyLogo"); }
Regards
David
Thanks Dave,
Ill try that out and let you know how I get on.
No worries. I'm pretty sure that's what you need.
Cheers Dave,
Problem Solved :)
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
Converting iMedia to image in Umbraco 8
I have uploaded an image to Umbraco using code.
This returns an IMedia object. Now that I have inserted the image into Umbraco I want to use the the CropUrl.
Does anyone know how to convert an IMedia to Image?
Hi Nathan,
I am not sure you need to convert to an Image. I would say you want to be converting to IPublishedContent.
You then have all the usual fields .Url, .GetCropUrl etc.
I think this is what you need.
Regards
David
Thanks Dave,
Ill try that out and let you know how I get on.
No worries. I'm pretty sure that's what you need.
Cheers Dave,
Problem Solved :)
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.