Pass file attachment thumbnails along with oEmbed data.
This commit is contained in:
parent
c36fecb794
commit
6d7f02ff31
@ -112,6 +112,12 @@ class OembedAction extends Action
|
|||||||
//$oembed['width']=
|
//$oembed['width']=
|
||||||
//$oembed['height']=
|
//$oembed['height']=
|
||||||
$oembed['url']=$attachment->url;
|
$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{
|
}else{
|
||||||
$oembed['type']='link';
|
$oembed['type']='link';
|
||||||
$oembed['url']=common_local_url('attachment',
|
$oembed['url']=common_local_url('attachment',
|
||||||
|
@ -384,4 +384,14 @@ class File extends Memcached_DataObject
|
|||||||
$enclosure = $this->getEnclosure();
|
$enclosure = $this->getEnclosure();
|
||||||
return !empty($enclosure);
|
return !empty($enclosure);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the attachment's thumbnail record, if any.
|
||||||
|
*
|
||||||
|
* @return File_thumbnail
|
||||||
|
*/
|
||||||
|
function getThumbnail()
|
||||||
|
{
|
||||||
|
return File_thumbnail::staticGet('file_id', $this->id);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user