- $img_str = Network::fetchUrl($image);
-
- $tempfile = tempnam(get_temppath(), "cache");
- file_put_contents($tempfile, $img_str);
-
- // Twitter had changed something so that the old library doesn't work anymore
- // so we are using a new library for twitter
- // To-Do:
- // Switching completely to this library with all functions
- require_once "addon/twitter/codebird.php";
-
- $cb = \Codebird\Codebird::getInstance();
- $cb->setConsumerKey($ckey, $csecret);
- $cb->setToken($otoken, $osecret);
+ $connection = new TwitterOAuth($ckey, $csecret, $otoken, $osecret);
+ $media = $connection->upload('media/upload', ['media' => $image]);