From 5b541e380ae8f5b865ac51cc2b88c31976012317 Mon Sep 17 00:00:00 2001 From: logmanoriginal Date: Tue, 2 May 2017 21:45:22 +0200 Subject: [PATCH] [TwitterBridge] Optimize returned image sizes Twitter provides an easy way to receive various image sizes based on the same image URI: https://dev.twitter.com/overview/api/entities-in-twitter-objects We support different sizes: thumb, small, medium and large. The media_url defaults to medium but you can retrieve the media in different sizes by appending a colon + the size key (for example: https://pbs.twimg.com/media/A7EiDWcCYAAZT1D.jpg:thumb). -- Twitter Developer Documentation TwitterBridge now makes use of this feature in order to provide thumbnail images in the content and original sized images as enclosures. References #526 --- bridges/TwitterBridge.php | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/bridges/TwitterBridge.php b/bridges/TwitterBridge.php index 316094d1..081cd2a5 100644 --- a/bridges/TwitterBridge.php +++ b/bridges/TwitterBridge.php @@ -153,13 +153,13 @@ EOD; $image = $this->getImageURI($tweet); if(!$this->getInput('noimg') && !is_null($image)){ // add enclosures - $item['enclosures'] = array($this->getImageURI($tweet)); + $item['enclosures'] = array($image . ':orig'); $image_html = << + + src="{$image}:thumb" /> EOD; } @@ -195,13 +195,13 @@ EOD; $quotedImage = $this->getQuotedImageURI($tweet); if(!$this->getInput('noimg') && !is_null($quotedImage)){ // add enclosures - $item['enclosures'] = array($this->getQuotedImageURI($tweet)); + $item['enclosures'] = array($quotedImage . ':orig'); $quotedImage_html = << + + src="{$quotedImage}:thumb" /> EOD; }