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,
How can I extend the media property URL so that instead of returning the relative path to media of the image
object.Url = /media/123/filename.png
it starts returning what I want
object.Url = //mydomain.url/folder/media/123/filename.png
Note. Only on media types, ... on ContentPickers, etc, shoud continue to return the relative url
Thanks.
Do you mean globally or just in your views? If the latter, you can do the following when you query media.
var typedMediaPickerSingle = Model.Content.GetPropertyValue<IPublishedContent>("imageAlias"); if (typedMediaPickerSingle != null) { var imagePath = @Request.Url.Scheme + "://" + @Request.Url.Host + @typedMediaPickerSingle.Url; <img src="@imagePath"> }
Globally, without having the need to go trough all views and change.
Sorry, forgot the term, basically, I want to override the .URL property on the media objects by my own result.
source code returns
image.Url = /media/1234/filename.png
and I what to keep the same property usage on the view (without having to change my views), but to return my override result, like:
image.Url = https://mydomain.com/folder/media/1234/filename.png
Thanks,
is working on a reply...
Write your reply to:
Upload image
Image will be uploaded when post is submitted
Extending property URL on media objects only
Hi,
How can I extend the media property URL so that instead of returning the relative path to media of the image
it starts returning what I want
Note. Only on media types, ... on ContentPickers, etc, shoud continue to return the relative url
Thanks.
Do you mean globally or just in your views? If the latter, you can do the following when you query media.
Globally, without having the need to go trough all views and change.
Sorry, forgot the term, basically, I want to override the .URL property on the media objects by my own result.
source code returns
and I what to keep the same property usage on the view (without having to change my views), but to return my override result, like:
Thanks,
is working on a reply...