php - How to Let Facebook Share Recognise Random Background Image -


my problem is, generating background images per css , php on web site http://goo.gl/vdtmbk this:

css:

background: url(random_img.php) no-repeat top left fixed; -webkit-background-size: cover; -moz-background-size: cover; -o-background-size: cover; background-size: cover;  background-attachment: fixed; 

php, random_img.php:

header("last-modified: " . gmdate("d, d m y h:i:s") . " gmt"); header("cache-control: no-store, no-cache, must-revalidate"); // http/1.1 header("cache-control: post-check=0, pre-check=0", false); header("pragma: no-cache"); // http/1.0 header("expires: sat, 26 jul 1997 05:00:00 gmt"); // date in past header('content-type: image/jpeg'); $vorresult = glob( "../../uploads/*1500x*.jpg" ); $result = array_diff( $vorresult, glob( "../../uploads/*{person,karte}*.jpg", glob_brace ) ); $seed = floor(time()/120);  srand($seed);  $random_image = $result[rand(0, count($result)-1)]; header('location:'.$random_image.''); 

i read somewhere: facebook should find images on one's web site no problem, long appear directly in html (as <img src="path/to/img.png" />) , not via css (background-image: url(path/to/img.png);).

so, there way solve this, facebook sharing "sees" random background image (to have in shared post on fb)?

this sounds bring many issues you. however, assuming should work (which i'm thinking no), generate fb og:image metatag dynamically (https://developers.facebook.com/docs/sharing/webmasters)

i'm not 100% sure work because if website popular, doubt facebook change image every time it's generated. 100% sure freeze title after number of shares.


Comments

Popular posts from this blog

mysql - FireDac error 314 - but DLLs are in program directory -

git - How to list all releases of public repository with GitHub API V3 -

c++ - Getting C2512 "no default constructor" for `ClassA` error on the first parentheses of constructor for `ClassB`? -