Simple php page that decides card contents depending on a GET parameter. If I take GET parameter off, it uses my default values for everything and renders the card correctly. But if I use the GET parameter, the card wont have image, it only has the text contents that are related to this parameter.
<meta name="twitter:card" content="summary_large_image" />
<meta name="twitter:title" content="<?php echo $ogtitle; ?>" />
<meta name="twitter:description" content="<?php echo $ogdesc; ?>" />
<meta name="twitter:image" content="<?php echo $ogimage; ?>" />
<meta name="twitter:image:alt" content="<?php echo $ogdesc; ?>" />
Even my default values are rendered by php and fetched from the very same database before rendering.
Only difference is the GET parameter, and the fact that when it’s set, php will fetch another image name from database before rendering anything.
But, without the parameter, it will anyways fetch the default image name from same database. And all images are in very same folder, so they surely are available (also by robots.txt).
Php structure goes like this:
- pdo->fetch image name and strings for meta data
- if(isset($_GET[‘p’])){ pdo->fetch another image name and strings
- render
And as said, this works well on other social medias.
I’ve tried every solution I’ve found, but nothing helps. I even got a real domain as I ended up thinking the cause was straight server address, and after that the only thing missing was SSL. But now when I got https set up, even it wont solve the issue.
Unfortunately I can’t provide url to this, but I hope someone might be able to tell me what can cause this. Only solution I now have, is to ditch the get parameter and instead of having a dynamic php page, breaking it into multiple individual pages. But that shouldn’t be the solution.
Edit:
To be add, it’s a bit depressing to see that even the example of summary_large_image at developer.twitter.com has only the image placeholder.