• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP Cloudinary类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了PHP中Cloudinary的典型用法代码示例。如果您正苦于以下问题:PHP Cloudinary类的具体用法?PHP Cloudinary怎么用?PHP Cloudinary使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



在下文中一共展示了Cloudinary类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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());
 }
开发者ID:teraone,项目名称:cloudinary-twig-extension,代码行数:7,代码来源:CloudinaryExtensionTest.php


示例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')));
 }
开发者ID:andela-oadebayo,项目名称:laravel4-cloudinary,代码行数:13,代码来源:CloudinaryWrapper.php


示例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')));
 }
开发者ID:jrm2k6,项目名称:cloudder,代码行数:14,代码来源:CloudinaryWrapper.php


示例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]);
 }
开发者ID:bryantmakesprog,项目名称:TwitterClone,代码行数:30,代码来源:TweetController.php


示例5: SetImageSize

 public function SetImageSize($width, $height, $crop = 'fill', $gravity = 'faces')
 {
     CloudinaryFile::get_api();
     $options = array('width' => $width, 'height' => $height, 'crop' => $crop, 'quality' => 70, 'gravity' => $gravity, 'secure_distribution' => true, 'secure' => true);
     $cloudinaryID = CloudinaryFile::get_public_id($this->CloudinaryURL);
     return Cloudinary::cloudinary_url($cloudinaryID . '.' . $this->Format, $options);
 }
开发者ID:silverstripers,项目名称:cloudinary,代码行数:7,代码来源:CloudinaryImage.php


示例6: init

    /**
     * Init
     * 	Include the javascript we will need
     *
     * @return void
     * @author Andrew Lowther <[email protected]>
     **/
    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);
    }
开发者ID:helpfulrobot,项目名称:andrewlowther-mediamanager,代码行数:32,代码来源:MediaManagerAdmin.php


示例7: Link

 public function Link()
 {
     CloudinaryFile::get_api();
     $options = array('secure_distribution' => true, 'secure' => true);
     $cloudinaryID = CloudinaryFile::get_public_id($this->CloudinaryURL);
     return Cloudinary::cloudinary_url($cloudinaryID . '.' . $this->Format, $options);
 }
开发者ID:silverstripers,项目名称:cloudinary,代码行数:7,代码来源:CloudinaryFile.php


示例8: setUp

 public function setUp()
 {
     \Cloudinary::reset_config();
     if (!Cloudinary::config_get("api_secret")) {
         $this->markTestSkipped('Please setup environment for Upload test to run');
     }
     $this->url_prefix = Cloudinary::config_get("upload_prefix", "https://api.cloudinary.com");
 }
开发者ID:engineor,项目名称:cloudinary_php,代码行数:8,代码来源:UploaderTest.php


示例9: 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");
     }
 }
开发者ID:cloudinary,项目名称:cloudinary_cake_php,代码行数:9,代码来源:CloudinaryCakeLoader.php


示例10: upload

 public function upload($file, $options = array())
 {
     $options['return_error'] = false;
     $ret = Uploader::upload($file, $options);
     $preloaded = new PreloadedFile(Cloudinary::signedPreloadedImage($ret));
     if ($this->verifyUpload && !$preloaded . is_valid()) {
         throw new \Exception("Error! Couldn't verify cloudinary response!");
     }
     $this->identifier = $preloaded->extendedIdentifier();
 }
开发者ID:engineor,项目名称:cloudinary_php,代码行数:10,代码来源:CloudinaryField.php


示例11: test_download_zip_url

 public function test_download_zip_url()
 {
     $result = Cloudinary::download_zip_url(array("tags" => $this->tag));
     $file = tempnam("tmp", "zip");
     file_put_contents($file, file_get_contents($result));
     $zip = new ZipArchive();
     $zip->open($file);
     $this->assertEquals(2, $zip->numFiles);
     unlink($file);
 }
开发者ID:leighvl,项目名称:cloudinary_php,代码行数:10,代码来源:ArchiveTest.php


示例12: __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 
       ]);
 }
开发者ID:phptuts,项目名称:personalsitesonataadmin,代码行数:17,代码来源:CloudinaryManager.php


示例13: test_cloudinary_url_from_cloudinary_field

 public function test_cloudinary_url_from_cloudinary_field()
 {
     // should use cloud_name from config
     $result = Cloudinary::cloudinary_url(new CloudinaryField("test"));
     $this->assertEquals("http://res.cloudinary.com/test123/image/upload/test", $result);
     // should ignore signature
     $result = Cloudinary::cloudinary_url(new CloudinaryField("test#signature"));
     $this->assertEquals("http://res.cloudinary.com/test123/image/upload/test", $result);
     $result = Cloudinary::cloudinary_url(new CloudinaryField("rss/imgt/v123/test.jpg"));
     $this->assertEquals("http://res.cloudinary.com/test123/rss/imgt/v123/test.jpg", $result);
 }
开发者ID:hidayat365,项目名称:phpindonesia.or.id-membership2,代码行数:11,代码来源:CloudinaryFieldTest.php


示例14: 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'] . ')'));
 }
开发者ID:andresmaeso,项目名称:neno,代码行数:12,代码来源:RoboFile.php


示例15: 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();
}
开发者ID:billadams,项目名称:forever-frame,代码行数:12,代码来源:wppa-cloudinary.php


示例16: userPhoto

 public function userPhoto($public_id = null, $options = [])
 {
     $default = $this->baseUrl() . '/public/images/team.png';
     if (null === $public_id) {
         return $default;
     }
     try {
         $options += ['tags' => 'user-avatar', 'crop' => 'fill'];
         $cdn_upload_path = 'phpindonesia/' . $this->settings['mode'] . '/';
         return \Cloudinary::cloudinary_url($cdn_upload_path . $public_id, $options);
     } catch (\Exception $e) {
         return $default;
     }
 }
开发者ID:hidayat365,项目名称:phpindonesia.or.id-membership2,代码行数:14,代码来源:PlatesUriExtension.php


示例17: userPhoto

 /**
  * Retrieve user photo from CDN
  *
  * @param string $publicId User photo public ID
  * @param array  $options  CDN options
  * @return string
  */
 public function userPhoto($publicId = null, $options = [])
 {
     $default = $this->template->asset('/images/team.png');
     if (null === $publicId) {
         return $default;
     }
     try {
         $options += ['tags' => 'user-avatar', 'crop' => 'fill'];
         $cdnTargetPath = 'phpindonesia/' . $this->mode . '/';
         return \Cloudinary::cloudinary_url($cdnTargetPath . $publicId, $options);
     } catch (\Exception $e) {
         return $default;
     }
 }
开发者ID:aswitahidayat,项目名称:phpindonesia.or.id-membership2,代码行数:21,代码来源:ViewExtension.php


示例18: 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);
         });
     }
 }
开发者ID:nilsenpaul,项目名称:npcloudinary,代码行数:19,代码来源:NpCloudinaryPlugin.php


示例19: 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']));*/
 }
开发者ID:javigomez,项目名称:neno,代码行数:16,代码来源:NenoExtension.php


示例20: setUp

 public function setUp()
 {
     if (!Cloudinary::config_get("api_secret")) {
         $this->markTestSkipped('Please setup environment for API test to run');
     }
     $this->api = new \Cloudinary\Api();
     if (self::$initialized) {
         return;
     }
     self::$initialized = TRUE;
     try {
         $this->api->delete_resources(array("api_test", "api_test2", "api_test3", "api_test5"));
     } catch (Exception $e) {
     }
     try {
         $this->api->delete_transformation("api_test_transformation");
     } catch (Exception $e) {
     }
     try {
         $this->api->delete_transformation("api_test_transformation2");
     } catch (Exception $e) {
     }
     try {
         $this->api->delete_transformation("api_test_transformation3");
     } catch (Exception $e) {
     }
     try {
         $this->api->delete_transformation("api_test_upload_preset");
     } catch (Exception $e) {
     }
     try {
         $this->api->delete_transformation("api_test_upload_preset2");
     } catch (Exception $e) {
     }
     try {
         $this->api->delete_transformation("api_test_upload_preset3");
     } catch (Exception $e) {
     }
     try {
         $this->api->delete_transformation("api_test_upload_preset4");
     } catch (Exception $e) {
     }
     self::$timestamp_tag = "api_test_tag_" . time();
     \Cloudinary\Uploader::upload("tests/logo.png", array("public_id" => "api_test", "tags" => array("api_test_tag", self::$timestamp_tag), "context" => "key=value", "eager" => array("transformation" => array("width" => 100, "crop" => "scale"))));
     \Cloudinary\Uploader::upload("tests/logo.png", array("public_id" => "api_test2", "tags" => array("api_test_tag", self::$timestamp_tag), "context" => "key=value", "eager" => array("transformation" => array("width" => 100, "crop" => "scale"))));
 }
开发者ID:uiDeveloper116,项目名称:webstore,代码行数:46,代码来源:ApiTest.php



注:本文中的Cloudinary类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP Club类代码示例发布时间:2022-05-23
下一篇:
PHP Cloud类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap