Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Anders Brohus 194 posts 475 karma points
    Sep 02, 2019 @ 20:37
    Anders Brohus
    0

    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,

    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?

    Kind regards, Anders

  • Shaishav Karnani from digitallymedia.com 354 posts 1638 karma points
    Sep 03, 2019 @ 05:04
    Shaishav Karnani from digitallymedia.com
    0

    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

  • Anders Brohus 194 posts 475 karma points
    Sep 03, 2019 @ 06:15
    Anders Brohus
    0

    Hi Shishav,

    UrlAbsolute is obsolete in V8.1 .. :)

    But i can't get the correct URL method inside my component :/

  • Shaishav Karnani from digitallymedia.com 354 posts 1638 karma points
    Sep 03, 2019 @ 06:25
    Shaishav Karnani from digitallymedia.com
    0

    Hi Andres,

    In that case, please can you try mediaItem.Url(mode:UrlMode.Absolute)

    Hope this helps.

    Cheers,

    Shaishav

  • Luke Hook 45 posts 175 karma points c-trib
    Oct 24, 2019 @ 17:02
    Luke Hook
    0

    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

  • Harikrishna Parmar 43 posts 262 karma points c-trib
    Feb 24, 2020 @ 03:56
    Harikrishna Parmar
    0

    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.

Please Sign in or register to post replies

Write your reply to:

Draft