How to get image src url for meta tags?

How to get image src url for meta tags?



We need to add meta-tags to our page so when it is shared on facebook, twitter or linked in the prober preview card was rendered. 

We use AddPostProcessingFilter action to add al nessasary tags and it works basically ok.  The problem is with the dynamic image from database that should be included in "card". In tags the src URL should be specified but the src is like <img alt="" src="/XXXXX/_image.aspx/H1E-gOeOCFWe2Yianx73JmUf2kXoF3GC4muw/07E1C51D47A9FB1166B852A9804C0FDD"> where bold part is generated by the platform. Is there a way to know or hardcode this url so it can be used in tags?

For Facebook there is a workaround as by default it loads first encountered image on page. But twitter doesn't do that and requires proper image url.

Thank you for any suggestions.


Hi Mykola.

If this is WEB, you can create a page to download the image that receives an ID and than finishes the preparation with a download that is the image.
So, in the page you want to add the image, you can put add the img tag setting the src like this: 

<img alt="" src="/YourApp/ImageForBackground.aspx?PictureId=1">

I have an example, that I used to set the background image of a SilkUI card:

But you can adapt it to generate the src and insert the address in the tag, as the address will always be the same, only the ID (or whatever you want to use to identify the image) will change.

The code is in this topic:

Hope it helps.

Eduardo Jauch


Hi Eduardo,

It works :) Thank you very much.

Also this can be used in native app too but instead of a page with download we can use a REST API with binary content output parameter.