- if(isset($post->attachment->name) and isset($post->attachment->href))
- $postarray["body"] .= "\n\n[bookmark=".$post->attachment->href."]".$post->attachment->name."[/bookmark]";
- elseif (isset($post->attachment->name) AND ($post->attachment->name != ""))
- $postarray["body"] .= "\n\n[b]" . $post->attachment->name."[/b]";
+ $content = "";
+ $type = "";
+
+ if (isset($post->attachment->name) and isset($post->attachment->href)) {
+ $oembed_data = oembed_fetch_url($post->attachment->href);
+ $type = $oembed_data->type;
+ $content = "[bookmark=".$post->attachment->href."]".$post->attachment->name."[/bookmark]";
+ } elseif (isset($post->attachment->name) AND ($post->attachment->name != ""))
+ $content = "[b]" . $post->attachment->name."[/b]";