These forums are provided for community interactions only. For official support please submit a support ticket.
You are not logged in.
I got the API feeding the meta tags on my site for Facebook and Google+. Facebook also likes the thumbnail, it shares properly. No luck on getting google+ to recognize the thumbnail meta. Anyone else have luck?
I pasted a jpg into my code and it rendered properly so fear it might be the php file ending.
Offline
I got no love from this comment so had to discover for myself. Google+ does not like the .php ending on the Director-API-generated files (and wont render a thumbnail). This was my workaround making a .jpg with the Director API of the album preview to stick in the meta data:
Some stuff made in Director to build an array, the link to an image in it, fed to this script which sees if a preview jpg is there (and not too old) if it is not there, will write one.
Tested and google+ likes it.
<?php
global $id, $img, $gallery_id, $metadata, $other_albums, $count, $data_array, $anchor, $dir_path, $device, $smart_array, $image_tag_array;
?>
<?php
$pageURL = (@$_SERVER["HTTPS"] == "on") ? "https://" : "http://";
if ($_SERVER["SERVER_PORT"] != "80")
{
$pageURL .= $_SERVER["SERVER_NAME"].":".$_SERVER["SERVER_PORT"].$_SERVER["REQUEST_URI"];
}
else
{
$pageURL .= $_SERVER["SERVER_NAME"].$_SERVER["REQUEST_URI"];
}
//var_dump($data_array['images'][0]['full']);
global $options;
$options['empty']=false;
$options['cache']=60*60*24;
$options['expired']=true;
$options['empty']==true;
$options['file'] = 'previews/'.$id.'.jpg';
$pos=strpos($pageURL,'share');
$pageURL=substr($pageURL,0,$pos);
$options['url']= $pageURL.$options['file'];
$options['image_url']= $data_array['images'][0]['full'];
$data_array['google']=$options['datasource'] = $pageURL.'previews/'.$id.'.jpg';
$options['datasource'] = str_replace('\\','/',$options['datasource']);
//var_dump($options);
if ( !is_file($options['file']) ){
// echo'write new file, as does not exist<br/>';
$options['empty']=true;
//write_file_with_string($options);
}// only write album if different name or doesn't exist yet
else {
// echo'file exzists<br/>';
check_if_file_is_good($options);// is it expired, is it empty?
}
if($options['empty']==true||$options['expired']==true){
write_preview_file($options);
// echo 'the file is not empty so...we wrote one<br/>';
}else{
// echo 'file was good, so just show the old one!!!!<br/>';
}
function check_if_file_is_good($options){
check_file_age($options);
check_file_size($options);
}
function check_file_size($options){
global $do_new_file, $options;
$director='';
$director=@file_get_contents($options['url']);
//// echo '<br/><br/><br/>'.strlen($director).'<br/><br/><br/>';
// echo 'size of file: '.filesize($director).'<br/>';
if(strlen($director)===0)
{
// echo 'file is data is fuct<br/>';
$options['empty']=true;
}//is not good so far
else{
// echo'file is not empty<br/>';
}
}
function check_file_age($options){
global $do_new_file, $options;
//caching time, in seconds 3600 = 1 hr, 86400= 1 day
$filemtime = @filemtime($options['file']); // returns FALSE if file does not exist
// echo'filemtime: '.$filemtime.'<br/>';
// echo'time: '.time().'<br/>';
// echo'this file is this old: '.(time() - $filemtime) .'<br/>';
if ((time() - $filemtime) >= $options['cache']){
$options['expired']=true;
// echo'file too old<br/>';
}
else{
$options['expired']=false;
// echo'this file is not old!<br/>';
}
}
function write_preview_file($options){
global $options;
$options['data']=@file_get_contents($options['image_url']);//only load the stuff if the file is not there
$fh = fopen($options['file'], 'w');
fwrite($fh,$options['data']);
fclose($fh);
// echo'wrote file<br/>';
}
//// echo 'this is the google image:';
// echo '<img itemprop="image" src ="'.$data_array['google'].'">';
?>Offline