Is it possible to get an absolute URL to an media item inside an component?
I wanna make an request to the ReSmush.It Web Service and they accept this,
For a standard call, with a JSON response, you just have to call this url http://api.resmush.it/ws.php and provide the image attribute like one of these options below :
GET Parameter "img"
POST Parameter "img"
FILES binary sent "files"
The webservice will return an array of informations about the compressed image (see below)
So i'm thinking about just giving them the absolute image url, or should i go with the FILES option?
If you would go with the FILES option how would you do that?
Get Absolute Url to media item - Component V8
Hi Our :)
Is it possible to get an absolute URL to an media item inside an component?
I wanna make an request to the ReSmush.It Web Service and they accept this,
So i'm thinking about just giving them the absolute image url, or should i go with the FILES option?
If you would go with the FILES option how would you do that?
Kind regards, Anders
Hi Anders,
You need to setup domain in culture and hostnames and then call mediaItem.UrlAbsolute() to get Absolute URL in v8.
Hope that will assist.
Regards,
Shaishav
Hi Shishav,
UrlAbsolute is obsolete in V8.1 .. :)
But i can't get the correct URL method inside my component :/
Hi Andres,
In that case, please can you try mediaItem.Url(mode:UrlMode.Absolute)
Hope this helps.
Cheers,
Shaishav
Hi Anders,
Did you ever find a solution to this? I too am trying to get the absolute URL of an Image from a PublishedContent item but having no luck.
Thanks, Luke
For Umbraco 8 : Here is a solution to get absolute URL.
content.Url(string culture = null, UrlMode mode = UrlMode.Auto)
which produces a relative-or-absolute Url depending on what's "best", but can be forced to produce absolute Urls with UrlMode.Absolute.
is working on a reply...