<?php
/**
 * description: Generates an image from the cumulative social media backlinks count
 *
 */


#-- retrieve
include("./social.count.php");
$url = @$_GET["url"];
if (filter_var($url, FILTER_VALIDATE_URL)) {
   $num = cache_fn("social_links_count", $url);
   $total = array_sum($num);
}
else {
   $total = "no url given";
}

#-- create PNG
$png = imagecreate(6 + 9 * strlen($total), 20);
$bg = imagecolorallocate($png, 255, 255, 255);
$fg = imagecolorallocate($png, 55, 55, 55);
imagestring($png, 5, 3, 2, "$total", $fg);

#-- output
header("Content-Type: image/png; version=1.2");
imagepng($png);
imagedestroy($png);


?>