- if(isset($item->picture) && isset($item->link))
- $content .= "\n".'[url='.$item->link.'][img]'.fpost_cleanpicture($item->picture).'[/img][/url]';
+ if (isset($item->picture))
+ $picture = $item->picture;
+
+ if (($type == "photo") AND isset($item->object_id)) {
+ logger('fbpost_fetchwall: fetching fbid '.$item->object_id, LOGGER_DEBUG);
+ $url = "https://graph.facebook.com/v2.0/".$item->object_id."/?access_token=".$access_token;
+ $feed = fetch_url($url);
+ $data = json_decode($feed);
+ if (isset($data->images)) {
+ $picture = $data->images[0]->source;
+ logger('fbpost_fetchwall: got fbid image '.$preview, LOGGER_DEBUG);
+ }
+ }
+
+ if(($picture != "") && isset($item->link))
+ $content .= "\n".'[url='.$item->link.'][img]'.$picture.'[/img][/url]';