config() public static method

public static config ( $values = NULL )
 public function testCl_upload_url()
 {
     Cloudinary::config_from_url(CLOUDINARY_URL);
     $ext = new CloudinaryExtension();
     $cloudName = Cloudinary::option_get(Cloudinary::config(), 'cloud_name');
     $this->assertEquals('https://api.cloudinary.com/v1_1/' . $cloudName . '/auto/upload', $ext->cl_upload_url());
 }
 /**
  * @DI\InjectParams({
  *     "cloudName" = @DI\Inject("%cloudinary_name%"),
  *     "apiKey" =  @DI\Inject("%cloudinary_api_key%"),
  *     "apiSecret" = @DI\Inject("%cloudinary_api_secret%")
  * })
  */
 public function __construct($cloudName, $apiKey, $apiSecret) 
 {
     $this->cloudName = $cloudName;
     
     \Cloudinary::config([
         "cloud_name" => $cloudName, 
         "api_key" => $apiKey, 
         "api_secret" => $apiSecret 
       ]);
 }
 /**
  * Create a new cloudinary instance.
  *
  * @param  \Illuminate\Config\Repository $config
  * @return void
  */
 public function __construct(Repository $config)
 {
     $this->cloudinary = new Cloudinary();
     $this->uploader = new Cloudinary\Uploader();
     $this->config = $config;
     $this->cloudinary->config(array('cloud_name' => $this->config->get('cloudinary::cloudName'), 'api_key' => $this->config->get('cloudinary::apiKey'), 'api_secret' => $this->config->get('cloudinary::apiSecret')));
 }
Example #4
0
 /**
  * Create a new cloudinary instance.
  *
  * @param  \Illuminate\Config\Repository $config
  * @return void
  */
 public function __construct(Repository $config, Cloudinary $cloudinary, Cloudinary\Uploader $uploader, Cloudinary\Api $api)
 {
     $this->cloudinary = $cloudinary;
     $this->uploader = $uploader;
     $this->api = $api;
     $this->config = $config;
     $this->cloudinary->config(array('cloud_name' => $this->config->get('cloudder.cloudName'), 'api_key' => $this->config->get('cloudder.apiKey'), 'api_secret' => $this->config->get('cloudder.apiSecret')));
 }
 /**
  * Creates a new Tweet model.
  * If creation is successful, the browser will be redirected to the 'view' page.
  * @return mixed
  */
 public function actionCreate()
 {
     $model = new Tweet();
     if ($model->load(Yii::$app->request->post())) {
         $model->owner = Yii::$app->user->identity->username;
         $date = new \DateTime();
         $model->timestamp = $date->getTimestamp();
         if ($model->save()) {
             //Upload images if need be.
             $image = UploadedFile::getInstances($model, 'image');
             \Cloudinary::config(array("cloud_name" => "dxqmggd5a", "api_key" => "314154111631994", "api_secret" => "KE-AgYwX8ecm8N2omI22RDVmFv4"));
             foreach ($image as $file) {
                 $uploadResult = \Cloudinary\Uploader::upload($file->tempName);
                 $myConnection = new MediaConnections();
                 $myConnection->tweet = $model->id;
                 $myConnection->url = $uploadResult['url'];
                 $myConnection->timestamp = $model->timestamp;
                 $myConnection->save();
             }
             User::findByUsername($model->owner)->createTweet();
             return $this->redirect(Yii::$app->request->referrer);
         }
     }
     return $this->render('create', ['model' => $model]);
 }
    /**
     * Init
     * 	Include the javascript we will need
     *
     * @return void
     * @author Andrew Lowther <*****@*****.**>
     **/
    public function init()
    {
        parent::init();
        // Get the config variables we'll need
        $config = Config::inst()->get('MediaManager', 'Cloudinary');
        // Inject them into the global scope
        Requirements::customScript(<<<JS
\t\t\t;(function (window, undefined) {
\t\t\t\twindow.mediamanager = window.mediamanager || {};
\t\t\t\twindow.mediamanager.cloudinary = {
\t\t\t\t\tcloud_name: "{$config['cloud_name']}",
\t\t\t\t\tapi_key: "{$config['api_key']}"
\t\t\t\t}
\t\t\t}/)(window);
JS
);
        // Get the base javascript path
        $BaseJsPath = MEDIAMANAGER_CORE_PATH . '/javascript';
        // Combine the cloudinary files into one super file
        Requirements::combine_files('cloudinary.js', array("{$BaseJsPath}/cloudinary/js/load-image.min.js", "{$BaseJsPath}/cloudinary/js/canvas-to-blob.min.js", "{$BaseJsPath}/cloudinary/js/jquery.fileupload.js", "{$BaseJsPath}/cloudinary/js/jquery.ui.widget.js", "{$BaseJsPath}/cloudinary/js/jquery.fileupload-process.js", "{$BaseJsPath}/cloudinary/js/jquery.fileupload-image.js", "{$BaseJsPath}/cloudinary/js/jquery.fileupload-validate.js", "{$BaseJsPath}/cloudinary/js/jquery.cloudinary.js"));
        // Same again for our files
        Requirements::combine_files('mediamanager.js', array("{$BaseJsPath}/mediamanager/mediamanager.core.js"));
        // Set the cloudinary config
        \Cloudinary::config($config);
    }
 /**
  * SetCloudinaryConfigs
  *
  * Check whether the database is ready and update cloudinary
  * configs from the site configs
  */
 public static function SetCloudinaryConfigs()
 {
     $arr = Config::inst()->get('CloudinaryConfigs', 'settings');
     if (isset($arr['CloudName']) && isset($arr['APIKey']) && isset($arr['APISecret']) && !empty($arr['CloudName']) && !empty($arr['APIKey']) && !empty($arr['APISecret'])) {
         Cloudinary::config(array("cloud_name" => $arr['CloudName'], "api_key" => $arr['APIKey'], "api_secret" => $arr['APISecret']));
     } else {
         user_error("Cloudinary configs are not defined", E_USER_ERROR);
     }
 }
 private static function configureCloudinary()
 {
     try {
         Configure::load('CloudinaryPrivate');
         \Cloudinary::config(Configure::read('cloudinary'));
     } catch (Exception $e) {
         CakeLog::notice("Couldn't find Config/CloudinaryPrivate.php file");
     }
 }
 public static function get_api()
 {
     if (self::$api) {
         return self::$api;
     }
     $config = SiteConfig::current_site_config();
     \Cloudinary::config(array("cloud_name" => $config->CloudName, "api_key" => $config->APIKey, "api_secret" => $config->APISecret));
     self::$api = new Api();
     return self::$api;
 }
 /**
  * Construct function of the resource.
  *
  * @return \Illuminate\Http\Response
  */
 public function __construct()
 {
     /**
      * Set your APIKey Cloudinary
      * cloudname
      * api_key
      * api_secret
      */
     \Cloudinary::config(array("cloud_name" => "cloudname", "api_key" => "", "api_secret" => ""));
 }
function wppa_load_cloudinary()
{
    if (get_option('wppa_cdn_service', 'nil') != 'cloudinary') {
        return;
    }
    require_once 'cloudinary/src/Cloudinary.php';
    require_once 'cloudinary/src/Uploader.php';
    require_once 'cloudinary/src/Api.php';
    \Cloudinary::config(array("cloud_name" => get_option('wppa_cdn_cloud_name'), "api_key" => get_option('wppa_cdn_api_key'), "api_secret" => get_option('wppa_cdn_api_secret')));
    global $wppa_cloudinary_api;
    $wppa_cloudinary_api = new \Cloudinary\Api();
}
Example #12
0
 public static function config_from_url($cloudinary_url)
 {
     self::$config = array();
     if ($cloudinary_url) {
         $uri = parse_url($cloudinary_url);
         $config = array("cloud_name" => $uri["host"], "api_key" => $uri["user"], "api_secret" => $uri["pass"], "private_cdn" => isset($uri["path"]));
         if (isset($uri["path"])) {
             $config["secure_distribution"] = substr($uri["path"], 1);
         }
         self::$config = array_merge(self::$config, $config);
     }
 }
Example #13
0
 public function sendScreenshot($cloudName, $apiKey, $apiSecret, $authToken)
 {
     $this->say('Sending image');
     // Upload image
     Cloudinary::config(array('cloud_name' => $cloudName, 'api_key' => $apiKey, 'api_secret' => $apiSecret));
     $result = \Cloudinary\Uploader::upload(realpath(dirname(__FILE__) . '/tests/_output/InstallNenoCest.installNeno.fail.png'));
     $this->say('Image sent');
     $this->say('Creating Github issue');
     $client = new \Github\Client();
     $client->authenticate($authToken, \Github\Client::AUTH_HTTP_TOKEN);
     $client->api('issue')->create('Jensen-Technologies', 'neno', array('title' => 'Test error', 'body' => '![Screenshot](' . $result['secure_url'] . ')'));
 }
 /**
  * @return mixed
  */
 public function init()
 {
     require_once craft()->path->getPluginsPath() . 'npcloudinary/vendor/autoload.php';
     $settings = craft()->plugins->getPlugin('npCloudinary')->getSettings();
     if (!craft()->request->post && ($settings['cloudName'] == '' || $settings['apiKey'] == '' || $settings['apiSecret'] == '')) {
         craft()->userSession->setFlash('error', Craft::t('To use NP Cloudinary, please set your API credentials first!'));
     } else {
         \Cloudinary::config(['cloud_name' => $settings['cloudName'], 'api_key' => $settings['apiKey'], 'api_secret' => $settings['apiSecret']]);
         craft()->on('assets.saveAsset', function (Event $event) {
             craft()->npCloudinary_cloudinary->uploadAsset($event->params['asset']);
         });
         craft()->on('assets.deleteAsset', function (Event $event) {
             craft()->npCloudinary_cloudinary->deleteAsset($event);
         });
     }
 }
Example #15
0
 public function testFailed(\Codeception\Event\FailEvent $e)
 {
     // Upload image
     Cloudinary::config(array('cloud_name' => $this->config['cloud_name'], 'api_key' => $this->config['api_key'], 'api_secret' => $this->config['api_secret']));
     $result = \Cloudinary\Uploader::upload(realpath(dirname(__FILE__) . '/../_output/InstallNenoCest.installNeno.fail.png'));
     /*
     		// Create Github issue
     		$client = new \Github\Client();
     		$token  = $this->config['token'];
     
     		$client->authenticate($token, \Github\Client::AUTH_URL_TOKEN);
     
     		$client
     			->api('issue')
     			->create('Jensen-Technologies', 'neno', array ('title' => 'Issue testing Neno', 'body' => $result['secure_url']));*/
 }
Example #16
0
 public function getItem()
 {
     $state = $this->getState();
     if ($state->container) {
         $container = $this->getService('com://admin/cloudinary.model.accounts')->slug($state->container)->getItem();
     } else {
         // Select default account
         $container = $this->getService('com://admin/cloudinary.model.accounts')->default(1)->getItem();
     }
     Cloudinary::config(array('cloud_name' => $container->cloud_name, 'api_key' => $container->api_key, 'api_secret' => $container->api_secret));
     // Force the path to a string so object with __toString() function will work
     $this->set('path', (string) $state->path);
     if (parent::getItem()->isNew()) {
         if (!$state->type) {
             $image = \Cloudinary\Uploader::upload(JPATH_FILES . '/' . $state->path);
         }
         $this->_item = $this->getRow()->setData(array('public_id' => $state->type ? $state->path : $image['public_id'], 'path' => $state->path, 'url' => $state->type ? '' : $image['url'], 'format' => $state->type ? '' : $image['format'], 'cloudinary_account_id' => $container->id));
         $this->_item->save();
     }
     if ($state->flags) {
         if (is_array($state->flags)) {
             $state->flags = implode('.', $state->flags);
         }
     }
     $file = $state->type ? $this->_item->public_id : $this->_item->public_id . '.' . $this->_item->format;
     $this->_item->setData(array('url' => cloudinary_url($file, $state->toArray())));
     if ($state->cache) {
         $this->_item->setData(array('url' => $this->_item->getImage($this->_item->url, $state->toArray())));
     }
     if ($state->getsize) {
         $curl = curl_init($this->_item->url);
         curl_setopt_array($curl, array(CURLOPT_HTTPHEADER => array('Range: bytes=0-32768'), CURLOPT_RETURNTRANSFER => 1));
         $image = imagecreatefromstring(curl_exec($curl));
         $this->_item->setData(array('width' => imagesx($image), 'height' => imagesy($image)));
         curl_close($curl);
     }
     $this->_item->setData(array('attribs' => KHelperArray::toString($state->attribs)));
     return $this->_item;
 }
Example #17
0
<?php

session_start();
$seller = $_SESSION['email'];
require 'Cloudinary.php';
require 'Uploader.php';
require 'Api.php';
\Cloudinary::config(array("cloud_name" => "www-fcshop-in", "api_key" => "892414419442113", "api_secret" => "7TNAx6phiZ0qqm9moTdxz2EGvSU"));
//getting post variable
//$category=$_GET['category'];
$category = $_SESSION['category'];
//database configuration
$database_name = 'firstcopy';
$database_user_name = 'admin';
$database_password = '******';
$dbhost = $OPENSHIFT_MONGODB_DB_HOST;
//if you have database user name & password then connection may be
//$connection=new Mongo("mongodb://$database_user_name:$database_password@$dbhost");
//Currently we are connecting to mongodb without authentication
try {
    //$db_connection = getenv('OPENSHIFT_MONGODB_DB_URL') ? getenv('OPENSHIFT_MONGODB_DB_URL') . $db_name : "mongodb://localhost:27017/" . $db_name;
    $connection = new MongoClient();
} catch (MongoConnectionException $e) {
    // if there was an error, we catch and display the problem here
    echo $e->getMessage();
} catch (MongoException $e) {
    echo $e->getMessage();
}
//checking the mongo database connection
if ($connection) {
    //connecting to database
Example #18
0
 public function test_cl_image_upload_tag()
 {
     Cloudinary::config(array("cloud_name" => "test123", "secure_distribution" => NULL, "private_cdn" => FALSE, "api_key" => "1234"));
     $tag = cl_image_upload_tag("image", array("public_id" => "hello", "html" => array("class" => "uploader")));
     $this->assertRegexp("/<input class='uploader cloudinary-fileupload' data-cloudinary-field='image' data-form-data='{\"timestamp\":\\d+,\"public_id\":\"hello\",\"signature\":\"[0-9a-f]+\",\"api_key\":\"1234\"}' data-url='https:\\/\\/api.cloudinary.com\\/v1_1\\/test123\\/auto\\/upload' name='file' type='file'\\/>/", $tag);
 }
Example #19
0
 private static function setKey()
 {
     \Cloudinary::config(array("cloud_name" => "change-my-world-now", "api_key" => "125692255259728", "api_secret" => "xTgojKXezGKFAd6v2aGQ_7mvmdM"));
 }
        $validator->rule('verifyCaptcha', 'captcha');
    }
    return $validator;
};
/**
 * Setup flash message container
 *
 * @return \Slim\Flash\Messages
 */
$container['flash'] = function () {
    return new Slim\Flash\Messages();
};
/**
 * Setup cloudinary config before view
 */
Cloudinary::config($container->get('settings')['cloudinary']);
/**
 * Setup view container
 *
 * @return \Projek\Slim\Plates
 */
$container['view'] = function ($container) {
    $settings = $container->get('settings');
    $request = $container->get('request');
    $view = new Projek\Slim\Plates($settings['view'], $container->get('response'));
    // Add app view folders
    $view->addFolder('layouts', $settings['view']['directory'] . '/layouts');
    $view->addFolder('sections', $settings['view']['directory'] . '/sections');
    // Load app view extensions
    $view->loadExtension(new PlatesAsset(WWW_DIR));
    $view->loadExtension(new Membership\ViewExtension($request, $container->get('flash'), $settings['mode']));
Example #21
0
*/
use Illuminate\Support\Facades\Auth;
use Illuminate\Support\Facades\Input;
use App\User;
use App\Property;
use App\City;
use App\Comment;
use App\District;
use App\PropertyFeatures;
use App\Picture;
use App\Degree;
use App\PropertyPictureBridge;
use App\UserPictureBridge;
use App\Booking;
use Illuminate\Http\Request;
\Cloudinary::config(array("cloud_name" => env('CLOUDINARY_CLOUD_NAME'), "api_key" => env('CLOUDINARY_API_KEY'), "api_secret" => env('CLOUDINARY_API_SECRET')));
Route::get('/echo/{val}', function ($val) {
    return $val;
});
/*
|--------------------------------------------------------------------------
| Application Routes
|--------------------------------------------------------------------------
|
| This route group applies the "web" middleware group to every route
| it contains. The "web" middleware group is defined in your HTTP
| kernel and includes session state, CSRF protection, and more.
|
*/
Route::group(['middleware' => ['web']], function () {
    Route::auth();
<?php

require 'bootstrap.php';
set_time_limit(0);
\Cloudinary::config($container['settings']['cloudinary']);
$env_mode = $container['settings']['mode'];
$cdn_upload_path = 'phpindonesia/' . $env_mode . '/';
$user_photo_path = $container['settings']['upload_photo_profile_path'];
$files = scandir(rtrim($user_photo_path, _DS_));
echo "Upload user photos...\n\n";
$num = 1;
foreach ($files as $file) {
    if ($file != '.' && $file != '..') {
        $file_noext = explode('.', $file)[0];
        $options = ['public_id' => $cdn_upload_path . $file_noext, 'tags' => ['user-avatar']];
        // Upload file
        echo "Uploading " . $num . "." . $file . "\n";
        \Cloudinary\Uploader::upload($user_photo_path . $file, $options);
    }
    $num++;
}
echo "Done!\n\n";
 public function test_responsive_width()
 {
     // should add responsive width transformation
     $tag = cl_image_tag("hello", array("responsive_width" => True, "format" => "png"));
     $this->assertEquals("<img class='cld-responsive' data-src='http://res.cloudinary.com/test123/image/upload/c_limit,w_auto/hello.png'/>", $tag);
     $options = array("width" => 100, "height" => 100, "crop" => "crop", "responsive_width" => TRUE);
     $result = Cloudinary::cloudinary_url("test", $options);
     $this->assertEquals($options, array("responsive" => TRUE));
     $this->assertEquals($result, CloudinaryTest::DEFAULT_UPLOAD_PATH . "c_crop,h_100,w_100/c_limit,w_auto/test");
     Cloudinary::config(array("responsive_width_transformation" => array("width" => "auto", "crop" => "pad")));
     $options = array("width" => 100, "height" => 100, "crop" => "crop", "responsive_width" => TRUE);
     $result = Cloudinary::cloudinary_url("test", $options);
     $this->assertEquals($options, array("responsive" => TRUE));
     $this->assertEquals($result, CloudinaryTest::DEFAULT_UPLOAD_PATH . "c_crop,h_100,w_100/c_pad,w_auto/test");
 }
Example #24
0
<?php

require 'Cloudinary.php';
require 'Uploader.php';
require 'Api.php';
\Cloudinary::config(array("cloud_name" => "test2dh", "api_key" => "941329182588371", "api_secret" => "RxrcLdgjserd-xwZYd_sQvkwZZo"));
$response = \Cloudinary\Uploader::upload("http://whiteglovesme.com/pics/driver/doc/11366088760744.png");
var_dump($response);
//echo cl_image_tag("ezoe1y1z6ltvsxuyrsgu.png");
 /**
  * Constructor
  *
  * @return void
  * @author Andrew Lowther <*****@*****.**>
  **/
 public function __construct()
 {
     $this->config = Config::inst()->get('MediaManager', 'Cloudinary');
     \Cloudinary::config($this->config);
 }
Example #26
0
 public function init()
 {
     \Cloudinary::config($this->params);
 }
 /**
  * @param array $options
  * The most important options are:
  * * string $cloud_name Your cloud name
  * * string $api_key Your api key
  * * string $api_secret You api secret
  * * boolean $overwrite Weather to overwrite existing file by rename or copy?
  */
 public function __construct(array $options)
 {
     \Cloudinary::config($options);
 }
Example #28
0
 /**
  * @param array $options
  *                       The most important options are:
  *                       * string $cloud_name Your cloud name
  *                       * string $api_key Your api key
  *                       * string $api_secret You api secret
  *                       * boolean $overwrite Weather to overwrite existing file by rename or copy?
  */
 public function configure(array $options = [])
 {
     \Cloudinary::config($options);
 }
Example #29
0
<?php

/*
|--------------------------------------------------------------------------
| Ninja Media Script Routes
|--------------------------------------------------------------------------
|
*/
// Setting Cloudinary
\Cloudinary::config(array("cloud_name" => "dp0wg3gds", "api_key" => "934528342182424", "api_secret" => "_Q8oIzZvuVQ-FCM0qrG88Tpmpy0"));
// **********	INSTALLATION ROUTES *********//
Route::get('install', 'InstallController@install');
Route::post('install_setup', 'InstallController@setup');
Route::post('install_connection', 'InstallController@test_db_connection');
Route::post('install_data', 'InstallController@add_db_data');
Route::post('install_admin', 'InstallController@add_admin_user');
// ********** UPGRADE ROUTES **********//
Route::get('upgrade', 'InstallController@upgrade');
// **********	HOME/ROOT ROUTE *********//
Route::get('/', 'HomeController@home');
// ********* POPULAR ROUTE ********** //
Route::get('popular', function () {
    $media = Media::where('active', '=', '1')->join('media_likes', 'media.id', '=', 'media_likes.media_id')->groupBy('media_likes.media_id')->orderBy(DB::raw('COUNT(media_likes.id)'), 'DESC')->select('media.*')->paginate(30);
    $data = array('media' => $media, 'categories' => Category::all(), 'pages' => Page::all(), 'settings' => Setting::first());
    return View::make('Theme::home', $data);
});
Route::get('popular/week', function () {
    $media = Media::where('active', '=', '1')->join('media_likes', 'media.id', '=', 'media_likes.media_id')->where('media_likes.created_at', '>=', date('Y-m-d H:i:s', strtotime('-1 week')))->groupBy('media_likes.media_id')->orderBy(DB::raw('COUNT(media_likes.id)'), 'DESC')->select('media.*')->paginate(30);
    $data = array('media' => $media, 'categories' => Category::all(), 'pages' => Page::all(), 'settings' => Setting::first());
    return View::make('Theme::home', $data);
});
 public function setUp()
 {
     Cloudinary::config(array("cloud_name" => "test123", "secure_distribution" => NULL, "private_cdn" => FALSE));
 }