From: Brion Vibber Date: Mon, 15 Nov 2010 20:57:15 +0000 (-0800) Subject: Include width/height of locally-uploaded images in our oembed provider data for attac... X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=89d59936748ee55bff31f161e6a0f2a1cbd44635;p=quix0rs-gnu-social.git Include width/height of locally-uploaded images in our oembed provider data for attachment pages. --- diff --git a/actions/oembed.php b/actions/oembed.php index 11d8145837..09d68a446e 100644 --- a/actions/oembed.php +++ b/actions/oembed.php @@ -108,9 +108,16 @@ 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) {