+function fb_get_photo($uid,$link) {
+ $access_token = get_pconfig($uid,'facebook','access_token');
+ if(! $access_token || (! stristr($link,'facebook.com/photo.php')))
+ return "\n" . '[url=' . $link . ']' . t('link') . '[/url]';
+ $ret = preg_match('/fbid=([0-9]*)/',$link,$match);
+ if($ret)
+ $photo_id = $match[1];
+ $x = fetch_url('https://graph.facebook.com/' . $photo_id . '?access_token=' . $access_token);
+ $j = json_decode($x);
+ if($j->picture)
+ return "\n\n" . '[url=' . $link . '][img]' . $j->picture . '[/img][/url]';
+ else
+ return "\n" . '[url=' . $link . ']' . t('link') . '[/url]';
+}
+