I have a list of urls pointing to images, which are originated in various subsites - sometimes burried in nested folder structures. Now, my question is: Is there any way I can derive the url of the containing subsite from such image url within the code of a display template?
I know it's not possible by pure string operations, since the folder structures have no clear pattern, but I hoped I somehow could get the context of the subsite and work from there. Something like this:
var ctx = SP.ClientContext(imageUrl);
var subsiteUrl = ctx.get_web().get_url();
Unfortunately, the context I receive from the imageUrl is invalid. Any ideas? Thx!