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 image url , alias image How to set value media picker ?
Hi Nguyen
Do you have media Id already? After image upload you have to have media Id, then you can easily set media id to content node media picker like that:
var node = ApplicationContext.Services.ContentService.GetById(productId); var locaUdi = Udi.Create(Constants.UdiEntityType.Media, media.Key); node.SetValue( "mediaPicker", locaUdi.ToString() ); cntsvc.SaveAndPublishWithStatus(node);
Thanks, Alex
Hi Alex
i see have "media.Key"
So what is "media"?
Oh again you are. I will try Thank you very much
So, How to get media Id from Url or alias image
I want rename image url when save&public content.
So media id has not yet?
If anyone is having trouble with Umbraco 8 then this is how I do it.
You basically need to get the UDI of the media item and use this to pass into the media picker field.
var content = _contentService.GetById("content-node-id-here"); if (content != null) { content.SetValue("basicStringValue", "some-string-content"); content.SetValue("anotherBasicStringValue", "some-string-content"); IMedia media = _mediaService.GetById(mediaId); if(media != null) { content.SetValue("logo", media.GetUdi()); } if(image != null) _contentService.SaveAndPublish(content); }
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
Set value media picker from have image url
I have image url , alias image How to set value media picker ?
Hi Nguyen
Do you have media Id already? After image upload you have to have media Id, then you can easily set media id to content node media picker like that:
Thanks, Alex
Hi Alex
i see have "media.Key"
So what is "media"?
Oh again you are. I will try Thank you very much
So, How to get media Id from Url or alias image
I want rename image url when save&public content.
So media id has not yet?
If anyone is having trouble with Umbraco 8 then this is how I do it.
You basically need to get the UDI of the media item and use this to pass into the media picker field.
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.