Hi Alonso, I've just gone in and recreated the scenario in Kentico 10. When I look at the value stored by a Media seletor form control, I see something like this: ~/Blank/media/sample-images/Apples.jpg?ext=.jpg
, which for me I can browse without the ~
character. It's a little odd that you cannot, I wonder if you have any security permission issues?
I'm only concerning myself with the current document in my web part, so I have a public property:
public string NewsMediaImage => CurrentDocument.GetValue("NewsMedia").ToString();
And then in my markup, I'm just using:
<img src="<%=NewsMediaImage %>" />
That gives me the relative URL, to get the absolute, I can do something like this to my property:
public string NewsMediaImage => URLHelper.GetAbsoluteUrl(URLHelper.ResolveUrl(CurrentDocument.GetValue("NewsMedia").ToString()));
so that I get a URL more like this:
http://localhost/CX10/getmedia/5ec58766-348a-4bfa-9793-f1fe8caa2ebd/Apples.jpg.aspx?width=1800&height=2700&ext=.jpg
So in summary, try out CMS.Helpers.URLHelper
to resolve to the absolute.