1
0
Fork 0
forked from blallo/rss-bridge

[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
This commit is contained in:
logmanoriginal 2017-05-02 21:45:22 +02:00
parent c375ddd6ab
commit 5b541e380a

View file

@ -153,13 +153,13 @@ EOD;
$image = $this->getImageURI($tweet); $image = $this->getImageURI($tweet);
if(!$this->getInput('noimg') && !is_null($image)){ if(!$this->getInput('noimg') && !is_null($image)){
// add enclosures // add enclosures
$item['enclosures'] = array($this->getImageURI($tweet)); $item['enclosures'] = array($image . ':orig');
$image_html = <<<EOD $image_html = <<<EOD
<a href="{$image}"> <a href="{$image}:orig">
<img <img
style="align:top; max-width:558px; border:1px solid black;" style="align:top; max-width:558px; border:1px solid black;"
src="{$image}" /> src="{$image}:thumb" />
</a> </a>
EOD; EOD;
} }
@ -195,13 +195,13 @@ EOD;
$quotedImage = $this->getQuotedImageURI($tweet); $quotedImage = $this->getQuotedImageURI($tweet);
if(!$this->getInput('noimg') && !is_null($quotedImage)){ if(!$this->getInput('noimg') && !is_null($quotedImage)){
// add enclosures // add enclosures
$item['enclosures'] = array($this->getQuotedImageURI($tweet)); $item['enclosures'] = array($quotedImage . ':orig');
$quotedImage_html = <<<EOD $quotedImage_html = <<<EOD
<a href="{$quotedImage}"> <a href="{$quotedImage}:orig">
<img <img
style="align:top; max-width:558px; border:1px solid black;" style="align:top; max-width:558px; border:1px solid black;"
src="{$quotedImage}" /> src="{$quotedImage}:thumb" />
</a> </a>
EOD; EOD;
} }