Example #1
0
 public static function uploadHelper($file)
 {
     $imgurKey = AppSetting::findOne('imgur_key')->string_value;
     $imgurSecret = AppSetting::findOne('imgur_secret')->string_value;
     $imgurToken = AppSetting::findOne('imgur_token')->string_value;
     $cacher = new FilesystemCache('/tmp');
     $uploader = RemoteImageUploader\Factory::create('Imgur', array('cacher' => $cacher, 'api_key' => $imgurKey, 'api_secret' => $imgurSecret, 'refresh_token' => $imgurToken, 'auto_authorize' => false, 'username' => '', 'password' => ''));
     $uploader->authorize();
     $url = $uploader->upload($file);
     return $url;
 }
 protected function getUploader()
 {
     if (empty(static::$uploader)) {
         //            $cacher = new \Doctrine\Common\Cache\FilesystemCache('/tmp');
         static::$uploader = \RemoteImageUploader\Factory::create('Imageshack', array('api_key' => '849MPVZ0ccccf4d199886724532ccaad3d8799cf', 'username' => '*****@*****.**', 'password' => 'b5SSquF7kmp1'));
         static::$uploader->login();
     }
     return static::$uploader;
 }