I am using opengraph filter module to generate preview from url. It is working perfectly. Now if a user has shared a video or image through url on the site and the preview is generated, when someone clicks on that preview, it takes the user to the link page (external website). What I want is, it should open on my site i.e embed on my site so that user can see the picture or video, generated from link preview, on my website. Currently, there is a video filter module which converts links to embeded videos, but it requires users to use this format [video:url] when sharing videos, but this format [video:url] for sharing a video link is not desirable, so leave it. I just mentioned it for reference/information.

  • Do you mean when the user click the preview, it will change it to video player and play the video? And now you can display the thumbnail and also the video player but you don't know how to combine them?
    – Jimmy Ko
    Commented Aug 12, 2016 at 12:06
  • Yes, the first part of your comment is exactly what I want. Second part is not because the video filter module, which changes the video link into an embeded video, requires a user to use this format [video:example.com] when sharing a video link, which is obviously not desirable. Yes, I can only generate thumbnail preview for now using open graph filter.
    – Umair
    Commented Aug 12, 2016 at 13:49
  • opengraph_filter module only support these og type array('title', 'description', 'image', 'url', 'type');. I found it from the module. You need to implements template_preprocess_opengraph_filter for supporting the video....
    – Jimmy Ko
    Commented Aug 12, 2016 at 13:57
  • I have edited the question. See last part. FYI, the video filter module does not generate a preview. Leave video filter module if its creating confusion.
    – Umair
    Commented Aug 12, 2016 at 16:49
  • Can you please tell me how?
    – Umair
    Commented Aug 12, 2016 at 16:50

1 Answer 1


Opengraph Filter module provides this: template_preprocess_opengraph_filter()

You can implements it in your custom module or theme for reading the video url. Then you can use the video url to output the player.

function mytheme_preprocess_opengraph_filter(&$variables) {
  $key = 'video';
  if (isset($variables['metatags']['og'][$key])) {
    $video_url = $variables['metatags']['og'][$key];

    // more code to operate $video_url.
    // dpm($video_url);

You can start with it. It would be a long story if you want to load the video after clicking the thumbnails. I would suggest you to split the question into multiple specific questions for different step. It is more easy for other to provide answer and also for those who is looking for answer. Thanks.

  • ok i will try. Can you suggest me how should I split my question?
    – Umair
    Commented Aug 12, 2016 at 16:55
  • What is og? Do i need to enable metatags module?
    – Umair
    Commented Aug 12, 2016 at 16:57
  • There is several step for your case. 1) get the video url from og. 2) generate the video player from video url. 3) ajax replace the video player with binding click event on thumbnails...... These steps would be a lot of code....
    – Jimmy Ko
    Commented Aug 12, 2016 at 16:58
  • og is Open Graph
    – Jimmy Ko
    Commented Aug 12, 2016 at 16:59
  • shared a [Question] (drupal.stackexchange.com/questions/211437/…)
    – Umair
    Commented Aug 13, 2016 at 9:57

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.