We are no longer offering accounts on this server. Consider https://gitlab.freedesktop.org/ as a place to host projects.

Commit 6d7f02ff authored by Brion Vibber's avatar Brion Vibber

Pass file attachment thumbnails along with oEmbed data.

parent c36fecb7
......@@ -112,6 +112,12 @@ class OembedAction extends Action
//$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',
......
......@@ -384,4 +384,14 @@ class File extends Memcached_DataObject
$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);
}
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment