本文整理汇总了PHP中Cloudinary::config方法的典型用法代码示例。如果您正苦于以下问题:PHP Cloudinary::config方法的具体用法?PHP Cloudinary::config怎么用?PHP Cloudinary::config使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Cloudinary
的用法示例。
在下文中一共展示了Cloudinary::config方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testCl_upload_url
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());
}
示例2: __construct
/**
* 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')));
}
示例3: __construct
/**
* 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')));
}
示例4: actionCreate
/**
* 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]);
}
示例5: init
/**
* Init
* Include the javascript we will need
*
* @return void
* @author Andrew Lowther <andrew.lowther@mademedia.co.uk>
**/
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);
}
示例6: SetCloudinaryConfigs
/**
* 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);
}
}
示例7: configureCloudinary
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");
}
}
示例8: get_api
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;
}
示例9: __construct
/**
* 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" => ""));
}
示例10: __construct
/**
* @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
]);
}
示例11: wppa_load_cloudinary
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();
}
示例12: config_from_url
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);
}
}
示例13: sendScreenshot
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'] . ')'));
}
示例14: init
/**
* @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);
});
}
}
示例15: testFailed
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']));*/
}