当前位置: 首页>>代码示例>>PHP>>正文


PHP Cloudinary::text_style方法代码示例

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


在下文中一共展示了Cloudinary::text_style方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: process_layer

 private static function process_layer($layer, $layer_parameter)
 {
     if (is_array($layer)) {
         $resource_type = Cloudinary::option_get($layer, "resource_type");
         $type = Cloudinary::option_get($layer, "type");
         $text = Cloudinary::option_get($layer, "text");
         $text_style = NULL;
         $public_id = Cloudinary::option_get($layer, "public_id");
         $format = Cloudinary::option_get($layer, "format");
         $components = array();
         if ($public_id != NULL) {
             $public_id = str_replace("/", ":", $public_id);
             if ($format != NULL) {
                 $public_id = $public_id . "." . $format;
             }
         }
         if ($text == NULL && $resource_type != "text") {
             if ($public_id == NULL) {
                 throw new InvalidArgumentException("Must supply public_id for {$resource_type} {$layer_parameter}");
             }
             if ($resource_type == "subtitles") {
                 $text_style = Cloudinary::text_style($layer, $layer_parameter);
             }
         } else {
             $resource_type = "text";
             $type = NULL;
             // type is ignored for text layers
             $text_style = Cloudinary::text_style($layer, $layer_parameter);
             #FIXME duplicate
             if ($text != NULL) {
                 if (!($public_id != NULL xor $text_style != NULL)) {
                     throw new InvalidArgumentException("Must supply either style parameters or a public_id when providing text parameter in a text {$layer_parameter}");
                 }
                 $text = Cloudinary::smart_escape($text);
                 $text = str_replace("%2C", "%252C", $text);
                 $text = str_replace("/", "%252F", $text);
             }
         }
         if ($resource_type != "image") {
             array_push($components, $resource_type);
         }
         if ($type != "upload") {
             array_push($components, $type);
         }
         array_push($components, $text_style);
         array_push($components, $public_id);
         array_push($components, $text);
         $layer = implode(":", array_filter($components, 'Cloudinary::is_not_null'));
     }
     return $layer;
 }
开发者ID:ShanksGtr,项目名称:AdminerTest,代码行数:51,代码来源:Cloudinary.php


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