//$oembed['width']=
//$oembed['height']=
$oembed['url']=$attachment->url;
+ $thumb = $attachment->getThumbnail();
+ if ($thumb) {
+ $oembed['thumbnail_url'] = $thumb->url;
+ $oembed['thumbnail_width'] = $thumb->width;
+ $oembed['thumbnail_height'] = $thumb->height;
+ }
}else{
$oembed['type']='link';
$oembed['url']=common_local_url('attachment',
$enclosure = $this->getEnclosure();
return !empty($enclosure);
}
+
+ /**
+ * Get the attachment's thumbnail record, if any.
+ *
+ * @return File_thumbnail
+ */
+ function getThumbnail()
+ {
+ return File_thumbnail::staticGet('file_id', $this->id);
+ }
}