I Have a litle bit problem with meta tag image script.
I already try like this :
<meta property="og:image" content="<?php echo "<img src='/img/$image'>"; ?>" />
is that possible ? thank you
I Have a litle bit problem with meta tag image script.
I already try like this :
<meta property="og:image" content="<?php echo "<img src='/img/$image'>"; ?>" />
is that possible ? thank you
You can't do it this way.
What you are trying to output, with your <?php echo "<img src='...'>"; ?>
is a full HTML tag.
But, you output this string inside the value of an attribute (namely, attribute content
) of a tag (<meta>
).
This value must be a string, and I believe that you simply need to print there the absolute URL of the image (not the full <img>
tag!).
You can not use image tag there. Instead, you should use
<meta property="og:image" content="<?php echo "http://$_SERVER[HTTP_HOST]/img/$image"; ?>" />