+ 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->getUrl();
+ try {
+ $thumb = $attachment->getThumbnail();
+ $oembed['thumbnail_url'] = $thumb->getUrl();
+ $oembed['thumbnail_width'] = $thumb->width;
+ $oembed['thumbnail_height'] = $thumb->height;
+ unset($thumb);
+ } catch (UnsupportedMediaException $e) {
+ // No thumbnail data available
+ }