X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=actions%2Foembed.php;h=bef707f92adeb8c1cec8e8cbd81fd536ee8ddc4b;hb=6c671141982c5837a2e5bf1e90de389c728d5dee;hp=1503aa9c2b93718f182686fbca8710714449c559;hpb=3f2c805652cd641f82af41cd5f92cb54d0457a59;p=quix0rs-gnu-social.git diff --git a/actions/oembed.php b/actions/oembed.php index 1503aa9c2b..bef707f92a 100644 --- a/actions/oembed.php +++ b/actions/oembed.php @@ -23,6 +23,7 @@ * @package StatusNet * @author Evan Prodromou * @copyright 2008 StatusNet, Inc. + * @copyright 2009 Free Software Foundation, Inc http://www.fsf.org * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0 * @link http://status.net/ */ @@ -78,11 +79,7 @@ class OembedAction extends Action if (empty($profile)) { $this->serverError(_('Notice has no profile.'), 500); } - if (!empty($profile->fullname)) { - $authorname = $profile->fullname . ' (' . $profile->nickname . ')'; - } else { - $authorname = $profile->nickname; - } + $authorname = $profile->getFancyName(); $oembed['title'] = sprintf(_('%1$s\'s status on %2$s'), $authorname, common_exact_date($notice->created)); @@ -111,10 +108,23 @@ class OembedAction extends Action $oembed['url']=$file_oembed->url; }else if(substr($attachment->mimetype,0,strlen('image/'))=='image/'){ $oembed['type']='photo'; - //TODO set width and height - //$oembed['width']= - //$oembed['height']= + if ($attachment->filename) { + $filepath = File::path($attachment->filename); + $gis = @getimagesize($filepath); + if ($gis) { + $oembed['width'] = $gis[0]; + $oembed['height'] = $gis[1]; + } else { + // TODO Either throw an error or find a fallback? + } + } $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', @@ -205,4 +215,15 @@ class OembedAction extends Action return; } + /** + * Is this action read-only? + * + * @param array $args other arguments + * + * @return boolean is read only action? + */ + function isReadOnly($args) + { + return true; + } }