I’m trying to integrate facebook share by using images directly from my database.
Static images using the OG tags:
<meta property="og:image" content="http://X.com/image.jpg" />"
Works fine.
However, my images are not static, they are being called from my database using this:
echo "<img src=\"pic.php?id=".$id."\"/>";
Where pictures render fine on my website but facebook share does not pick them up.
The logical thing in my mind then would be to do this:
echo "<meta property=\"og:image\" content=\"http://X.com/pic.php?id=".$id."\"/>";
Sadly, this does not work.
Any ideas?
I suggest you use a URL rewrite to create a friendly URL, e.g.
If you are using Apache, that would be a
.htaccessfile (assuming you havemod_rewriteenabled), something like: