function upload2picasa($file) { $remoteConfig = \Config::getSection("REMOTE_IMAGE"); $uploader = \ChipVN_ImageUploader_Manager::make('Picasa'); echo $uploader->login($remoteConfig["google_user_name"], $remoteConfig["google_user_pass"]); // we don't need password here //$uploader->setApi($remoteConfig["google_client_id"]); // register in console.developers.google.com //$uploader->setSecret($remoteConfig["google_secret_key"]); // you can set upload to an albumId by array of albums or an album, system will get a random album to upload //$uploader->setAlbumId(array('51652569125195125', '515124156195725')); //$uploader->setAlbumId('51652569125195125'); //echo("will echo noe"); //print_r($remoteConfig); //echo $uploader->addAlbum('testing 1'); //echo("ok on"); //if (!$uploader->hasValidToken()) { // $uploader->getOAuthToken('http://yourdomain.com/test.php'); //} //print_r($file); //echo $uploader->upload(getcwd() . '/test.jpg'); // this plugin does not support transload image }
$minSize = explode('x', $config['watermark_minimum_size']); if ($data_watermark && file_exists($logo) && (empty($config['watermark_minimum_size']) || count($minSize) == 2 && $minSize[0] <= $imageSize[0] && $minSize[1] <= $imageSize[1])) { $phpThumb->resize($data_resize)->createWatermark($logo, $data_watermark_position, 0); } else { $phpThumb->resize($data_resize); } $phpThumb->save($tempFile); } catch (Exception $e) { if (file_exists($tempFile)) { unlink($tempFile); } response_json(array('error' => true, 'message' => $e->getMessage())); } $server = strtolower($data_server); // setup general $uploader = ChipVN_ImageUploader_Manager::make(ucfirst($server)); $uploader->useCurl($config['use_curl']); $uploader->setCache($config['cache_adapter'], array('cache_dir' => $config['session_dir'])); $result = array(); try { $serverConfig = $config[$server]; switch ($server) { case 'imgur': if ($account = random_element($serverConfig['accounts'])) { $uploader->login($account['username'], $account['password']); } break; case 'imageshack': $account = random_element($serverConfig['accounts']); $apiKey = random_element($serverConfig['api_keys']); $uploader->login($account['username'], $account['password']);
<?php session_start(); header('Content-type: text/html;charset=utf-8'); error_reporting(E_ALL); ini_set('display_errors', 1); require 'includes/functions.php'; require 'vendor/ChipVN/ClassLoader/Loader.php'; ChipVN_ClassLoader_Loader::registerAutoload(); $config = (require 'includes/config.php'); $config = $config['flickr']; $callback = 'http' . (getenv('HTTPS') == 'on' ? 's' : '') . '://' . $_SERVER['HTTP_HOST'] . $_SERVER['PHP_SELF']; $uploader = ChipVN_ImageUploader_Manager::make('Flickr'); $api = random_element($config['api_keys']); $uploader->setApi($api['key']); $uploader->setSecret($api['secret']); $token = $uploader->getOAuthToken($callback); write_flickr_token($config['token_file'], $token['username'], $token['oauth_token'], $token['oauth_token_secret']); echo "Done!<br />"; echo '<a href="' . $callback . '">Click here to add new token (must use other yahoo account).</a>';