Include width/height of locally-uploaded images in our oembed provider data for attachment pages.
This commit is contained in:
parent
fe7cb35551
commit
89d5993674
|
@ -108,9 +108,16 @@ class OembedAction extends Action
|
||||||
$oembed['url']=$file_oembed->url;
|
$oembed['url']=$file_oembed->url;
|
||||||
}else if(substr($attachment->mimetype,0,strlen('image/'))=='image/'){
|
}else if(substr($attachment->mimetype,0,strlen('image/'))=='image/'){
|
||||||
$oembed['type']='photo';
|
$oembed['type']='photo';
|
||||||
//TODO set width and height
|
if ($attachment->filename) {
|
||||||
//$oembed['width']=
|
$filepath = File::path($attachment->filename);
|
||||||
//$oembed['height']=
|
$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;
|
$oembed['url']=$attachment->url;
|
||||||
$thumb = $attachment->getThumbnail();
|
$thumb = $attachment->getThumbnail();
|
||||||
if ($thumb) {
|
if ($thumb) {
|
||||||
|
|
Loading…
Reference in New Issue