Darrell
Darrell

Reputation: 45

og:image take php variable

I have a image tag that gets a php variable from another page,

 <img src="<?php echo urldecode($_GET['pic']); ?>" width="100%" alt="" />.

It works fine. I would like to know how to take that and make it work with the meta tags og:image and itemprop="image". I've tried several ways, but had no luck.

Thanks, Darrell

Upvotes: 0

Views: 3975

Answers (1)

Nick Clark
Nick Clark

Reputation: 4467

It needs to be in the HTML head.

Here is a modified example from http://ogp.me/

<html prefix="og: http://ogp.me/ns#">
<head>
<title>The Rock (1996)</title>
<meta property="og:title" content="The Rock" />
<meta property="og:type" content="video.movie" />
<meta property="og:url" content="http://www.imdb.com/title/tt0117500/" />
<meta property="og:image" content="<?php echo urldecode($_GET['pic']); ?>" />
...
</head>
...
</html>

Upvotes: 1

Related Questions