diff options
author | Brion Vibber <brion@pobox.com> | 2010-11-15 12:57:15 -0800 |
---|---|---|
committer | Brion Vibber <brion@pobox.com> | 2010-11-15 12:57:15 -0800 |
commit | 89d59936748ee55bff31f161e6a0f2a1cbd44635 (patch) | |
tree | 606576b7bc6effb3211ab5a189b518047d3371e0 /actions/oembed.php | |
parent | fe7cb35551053380a359c17a49402abeaf684f46 (diff) |
Include width/height of locally-uploaded images in our oembed provider data for attachment pages.
Diffstat (limited to 'actions/oembed.php')
-rw-r--r-- | actions/oembed.php | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/actions/oembed.php b/actions/oembed.php index 11d814583..09d68a446 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) { |