Search code examples
mediasap-commerce-cloudbackoffice

how to use sap-hybris media(image) url from out side- or how can link it


I want to use the image of sap-hybris by URL , how can get it Like- some URLs like:https://s3.amazonaws.com/manikart.bbb.dd/LOGO-512x512.png in this case, I want to use the sap-hybris media but from back-office, I only get this medias/sys_master/images/h50/h25/8855153901598/RapidHybrisLogo512512.png URL.


Solution

  • If you want to access media manually, all you need to do is prefix it with your site URL.

    Let's say
    Site URL: https://www.test.com/mystorefront
    Media URL: /medias/sys_master/images/h50/h25/8855153901598/RapidHybrisLogo512512.png

    Now, You can access media with https://www.test.com/mystorefront/medias/sys_master/images/h50/h25/8855153901598/RapidHybrisLogo512512.png

    If your requirement is to get the full media URL from the media object itself, then you can create a dynamic attribute say fullMediaURL in the MediaModel and write the logic to concat your basesiteURL with Media downloadURL in your dynamicAttributeProvider class.