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


PHP Cloudinary::option_consume方法代码示例

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


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

示例1: cl_image_tag

 function cl_image_tag($source, $options = array())
 {
     $source = cloudinary_url_internal($source, $options);
     if (isset($options["html_width"])) {
         $options["width"] = Cloudinary::option_consume($options, "html_width");
     }
     if (isset($options["html_height"])) {
         $options["height"] = Cloudinary::option_consume($options, "html_height");
     }
     $responsive = Cloudinary::option_consume($options, "responsive");
     $hidpi = Cloudinary::option_consume($options, "hidpi");
     if ($responsive || $hidpi) {
         $options["data-src"] = $source;
         $classes = array($responsive ? "cld-responsive" : "cld-hidpi");
         $current_class = Cloudinary::option_consume($options, "class");
         if ($current_class) {
             array_unshift($classes, $current_class);
         }
         $options["class"] = implode(" ", $classes);
         $source = Cloudinary::option_consume($options, "responsive_placeholder", Cloudinary::config_get("responsive_placeholder"));
         if ($source == "blank") {
             $source = Cloudinary::BLANK;
         }
     }
     $html = "<img ";
     if ($source) {
         $html .= "src='{$source}' ";
     }
     $html .= Cloudinary::html_attrs($options) . "/>";
     return $html;
 }
开发者ID:uiDeveloper116,项目名称:webstore,代码行数:31,代码来源:Helpers.php

示例2: build_eager

 public static function build_eager($transformations)
 {
     $eager = array();
     foreach (\Cloudinary::build_array($transformations) as $trans) {
         $transformation = $trans;
         $format = \Cloudinary::option_consume($transformation, "format");
         $single_eager = implode("/", array_filter(array(\Cloudinary::generate_transformation_string($transformation), $format)));
         array_push($eager, $single_eager);
     }
     return implode("|", $eager);
 }
开发者ID:ShanksGtr,项目名称:AdminerTest,代码行数:11,代码来源:Cloudinary.php

示例3: cl_video_tag

 function cl_video_tag($source, $options = array())
 {
     $source = preg_replace('/\\.(' . implode('|', default_source_types()) . ')$/', '', $source);
     $source_types = Cloudinary::option_consume($options, 'source_types', array());
     $source_transformation = Cloudinary::option_consume($options, 'source_transformation', array());
     $fallback = Cloudinary::option_consume($options, 'fallback_content', '');
     if (empty($source_types)) {
         $source_types = default_source_types();
     }
     $video_options = $options;
     if (array_key_exists('poster', $video_options)) {
         if (is_array($video_options['poster'])) {
             if (array_key_exists('public_id', $video_options['poster'])) {
                 $video_options['poster'] = cloudinary_url_internal($video_options['poster']['public_id'], $video_options['poster']);
             } else {
                 $video_options['poster'] = cl_video_thumbnail_path($source, $video_options['poster']);
             }
         }
     } else {
         $video_options['poster'] = cl_video_thumbnail_path($source, $options);
     }
     if (empty($video_options['poster'])) {
         unset($video_options['poster']);
     }
     $html = '<video ';
     if (!array_key_exists('resource_type', $video_options)) {
         $video_options['resource_type'] = 'video';
     }
     $multi_source = is_array($source_types);
     if (!$multi_source) {
         $source .= '.' . $source_types;
     }
     $src = cloudinary_url_internal($source, $video_options);
     if (!$multi_source) {
         $video_options['src'] = $src;
     }
     if (isset($video_options["html_width"])) {
         $video_options['width'] = Cloudinary::option_consume($video_options, 'html_width');
     }
     if (isset($video_options['html_height'])) {
         $video_options['height'] = Cloudinary::option_consume($video_options, 'html_height');
     }
     $html .= Cloudinary::html_attrs($video_options) . '>';
     if ($multi_source) {
         foreach ($source_types as $source_type) {
             $transformation = Cloudinary::option_consume($source_transformation, $source_type, array());
             $transformation = array_merge($options, $transformation);
             $src = cl_video_path($source . '.' . $source_type, $transformation);
             $video_type = $source_type == 'ogv' ? 'ogg' : $source_type;
             $mime_type = "video/{$video_type}";
             $html .= '<source ' . Cloudinary::html_attrs(array('src' => $src, 'type' => $mime_type)) . '>';
         }
     }
     $html .= $fallback;
     $html .= '</video>';
     return $html;
 }
开发者ID:cloudinary,项目名称:cloudinary_php,代码行数:57,代码来源:Helpers.php

示例4: build_responsive_breakpoints

 protected static function build_responsive_breakpoints($breakpoints)
 {
     if (!$breakpoints) {
         return NULL;
     }
     $breakpoints_params = array();
     foreach (\Cloudinary::build_array($breakpoints) as $breakpoint_settings) {
         if ($breakpoint_settings) {
             $transformation = \Cloudinary::option_consume($breakpoint_settings, "transformation");
             if ($transformation) {
                 $breakpoint_settings["transformation"] = \Cloudinary::generate_transformation_string($transformation);
             }
             array_push($breakpoints_params, $breakpoint_settings);
         }
     }
     return json_encode($breakpoints_params);
 }
开发者ID:IVsevolod,项目名称:zouk,代码行数:17,代码来源:Uploader.php

示例5: check_cloudinary_field

 public static function check_cloudinary_field($source, &$options = array())
 {
     $IDENTIFIER_RE = "~" . "^(?:([^/]+)/)??(?:([^/]+)/)??(?:(?:v(\\d+)/)(?:([^#]+)/)?)?" . "([^#/]+?)(?:\\.([^.#/]+))?(?:#([^/]+))?\$" . "~";
     $matches = array();
     if (!(is_object($source) && method_exists($source, 'identifier'))) {
         return $source;
     }
     $identifier = $source->identifier();
     if (!$identifier || strstr(':', $identifier) !== false || !preg_match($IDENTIFIER_RE, $identifier, $matches)) {
         return $source;
     }
     $optionNames = array('resource_type', 'type', 'version', 'folder', 'public_id', 'format');
     foreach ($optionNames as $index => $optionName) {
         if (@$matches[$index + 1]) {
             $options[$optionName] = $matches[$index + 1];
         }
     }
     return Cloudinary::option_consume($options, 'public_id');
 }
开发者ID:jbelke,项目名称:cloudinary_php,代码行数:19,代码来源:Cloudinary.php

示例6: cloudinary_url

 public static function cloudinary_url($source, &$options = array())
 {
     $type = Cloudinary::option_consume($options, "type", "upload");
     if ($type == "fetch" && !isset($options["fetch_format"])) {
         $options["fetch_format"] = Cloudinary::option_consume($options, "format");
     }
     $transformation = Cloudinary::generate_transformation_string($options);
     $resource_type = Cloudinary::option_consume($options, "resource_type", "image");
     $version = Cloudinary::option_consume($options, "version");
     $format = Cloudinary::option_consume($options, "format");
     $cloud_name = Cloudinary::option_consume($options, "cloud_name", Cloudinary::config_get("cloud_name"));
     if (!$cloud_name) {
         throw new InvalidArgumentException("Must supply cloud_name in tag or in configuration");
     }
     $secure = Cloudinary::option_consume($options, "secure", Cloudinary::config_get("secure"));
     $private_cdn = Cloudinary::option_consume($options, "private_cdn", Cloudinary::config_get("private_cdn"));
     $secure_distribution = Cloudinary::option_consume($options, "secure_distribution", Cloudinary::config_get("secure_distribution"));
     $cdn_subdomain = Cloudinary::option_consume($options, "cdn_subdomain", Cloudinary::config_get("cdn_subdomain"));
     $cname = Cloudinary::option_consume($options, "cname", Cloudinary::config_get("cname"));
     $original_source = $source;
     if (!$source) {
         return $original_source;
     }
     if (preg_match("/^https?:\\//i", $source)) {
         if ($type == "upload" || $type == "asset") {
             return $original_source;
         }
         $source = Cloudinary::smart_escape($source);
     } else {
         if ($format) {
             $source = $source . "." . $format;
         }
     }
     if ($secure && !$secure_distribution) {
         if ($private_cdn) {
             throw new InvalidArgumentException("secure_distribution not defined");
         } else {
             $secure_distribution = Cloudinary::SHARED_CDN;
         }
     }
     if ($secure) {
         $prefix = "https://" . $secure_distribution;
     } else {
         $crc = crc32($source);
         if ($crc < 0) {
             $crc += 4294967296;
         }
         $subdomain = $cdn_subdomain ? "a" . (fmod($crc, 5) + 1) . "." : "";
         $host = $cname ? $cname : ($private_cdn ? $cloud_name . "-" : "") . "res.cloudinary.com";
         $prefix = "http://" . $subdomain . $host;
     }
     if (!$private_cdn) {
         $prefix .= "/" . $cloud_name;
     }
     return preg_replace("/([^:])\\/+/", "\$1/", implode("/", array($prefix, $resource_type, $type, $transformation, $version ? "v" . $version : "", $source)));
 }
开发者ID:vanbungkring,项目名称:24custom,代码行数:56,代码来源:cloudinary_api.php

示例7: cl_image_tag

 echo "<div class='public_id'>" . $photo["public_id"] . "</div>";
 echo cl_image_tag($photo["public_id"], array_merge($thumbs_params, array("crop" => "fill")));
 ?>
         </a>
       
       <div class="less_info">
         <a href="#" class="toggle_info">More transformations...</a>
       </div>
       
       <div class="more_info">
         <a href="#" class="toggle_info">Hide transformations...</a>
         <table class="thumbnails">
           <?php 
 $thumbs = array(array("crop" => "fill", "radius" => 10), array("crop" => "scale"), array("crop" => "fit", "format" => "png"), array("crop" => "thumb", "gravity" => "face"), array("override" => true, "format" => "png", "angle" => 20, "transformation" => array("crop" => "fill", "gravity" => "north", "width" => 150, "height" => 150, "effect" => "sepia")));
 foreach ($thumbs as $params) {
     $merged_params = array_merge(\Cloudinary::option_consume($params, "override") ? array() : $thumbs_params, $params);
     echo "<td>";
     echo "<div class='thumbnail_holder'>";
     echo "<a target='_blank' href='" . cloudinary_url($photo["public_id"], $merged_params) . "'>" . cl_image_tag($photo["public_id"], $merged_params) . "</a>";
     echo "</div>";
     echo "<br/>";
     \PhotoAlbum\array_to_table($merged_params);
     echo "</td>";
 }
 ?>
           
         </table>
         
         <div class="note">             	
         	Take a look at our documentation of <a href="http://cloudinary.com/documentation/image_transformations" target="_blank">Image Transformations</a> for a full list of supported transformations.
         </div>	
开发者ID:hidayat365,项目名称:phpindonesia.or.id-membership2,代码行数:31,代码来源:list.php

示例8: cloudinary_url

 public static function cloudinary_url($source, &$options = array())
 {
     $type = Cloudinary::option_consume($options, "type", "upload");
     if ($type == "fetch" && !isset($options["fetch_format"])) {
         $options["fetch_format"] = Cloudinary::option_consume($options, "format");
     }
     $transformation = Cloudinary::generate_transformation_string($options);
     $resource_type = Cloudinary::option_consume($options, "resource_type", "image");
     $version = Cloudinary::option_consume($options, "version");
     $format = Cloudinary::option_consume($options, "format");
     $cloud_name = Cloudinary::option_consume($options, "cloud_name", Cloudinary::config_get("cloud_name"));
     if (!$cloud_name) {
         throw new InvalidArgumentException("Must supply cloud_name in tag or in configuration");
     }
     $secure = Cloudinary::option_consume($options, "secure", Cloudinary::config_get("secure"));
     $private_cdn = Cloudinary::option_consume($options, "private_cdn", Cloudinary::config_get("private_cdn"));
     $secure_distribution = Cloudinary::option_consume($options, "secure_distribution", Cloudinary::config_get("secure_distribution"));
     $cdn_subdomain = Cloudinary::option_consume($options, "cdn_subdomain", Cloudinary::config_get("cdn_subdomain"));
     $cname = Cloudinary::option_consume($options, "cname", Cloudinary::config_get("cname"));
     $shorten = Cloudinary::option_consume($options, "shorten", Cloudinary::config_get("shorten"));
     $original_source = $source;
     if (!$source) {
         return $original_source;
     }
     if (preg_match("/^https?:\\//i", $source)) {
         if ($type == "upload" || $type == "asset") {
             return $original_source;
         }
         $source = Cloudinary::smart_escape($source);
     } else {
         $source = Cloudinary::smart_escape(rawurldecode($source));
         if ($format) {
             $source = $source . "." . $format;
         }
     }
     $shared_domain = !$private_cdn;
     if ($secure) {
         if (!$secure_distribution || $secure_distribution == Cloudinary::OLD_AKAMAI_SHARED_CDN) {
             $secure_distribution = $private_cdn ? $cloud_name . "-res.cloudinary.com" : Cloudinary::SHARED_CDN;
         }
         $shared_domain = $shared_domain || $secure_distribution == Cloudinary::SHARED_CDN;
         $prefix = "https://" . $secure_distribution;
     } else {
         $subdomain = $cdn_subdomain ? "a" . ((crc32($source) % 5 + 5) % 5 + 1) . "." : "";
         $host = $cname ? $cname : ($private_cdn ? $cloud_name . "-" : "") . "res.cloudinary.com";
         $prefix = "http://" . $subdomain . $host;
     }
     if ($shared_domain) {
         $prefix .= "/" . $cloud_name;
     }
     if ($shorten && $resource_type == "image" && $type == "upload") {
         $resource_type = "iu";
         $type = "";
     }
     if (strpos($source, "/") && !preg_match("/^https?:\\//", $source) && !preg_match("/^v[0-9]+/", $source) && empty($version)) {
         $version = "1";
     }
     return preg_replace("/([^:])\\/+/", "\$1/", implode("/", array($prefix, $resource_type, $type, $transformation, $version ? "v" . $version : "", $source)));
 }
开发者ID:msayagh,项目名称:Quercus-source-code-Maven,代码行数:59,代码来源:Cloudinary.php

示例9: array

<?php

require 'main.php';
# You can add here your custom verification code
# Check for a valid Cloudinary response
$api_secret = Cloudinary::config_get("api_secret");
if (!$api_secret) {
    throw new \InvalidArgumentException("Must supply api_secret");
}
$existing_signature = \Cloudinary::option_consume($_POST, "signature");
$to_sign = array('public_id' => $_POST['public_id'], 'version' => $_POST['version']);
$calculated_signature = \Cloudinary::api_sign_request($to_sign, $api_secret);
if ($existing_signature == $calculated_signature) {
    # Create a model record using the data received (best practice is to save locally
    # only data needed for reaching the image on Cloudinary - public_id and version;
    # and fields that might be needed for your application (e.g.,), width, height)
    $photo = \PhotoAlbum\create_photo_model($_POST);
} else {
    error_log("Received signature verficiation failed (" . $existing_signature . " != " . $calculated_signature . "). data: " . \PhotoAlbum\ret_var_dump($_POST));
}
开发者ID:hidayat365,项目名称:phpindonesia.or.id-membership2,代码行数:20,代码来源:upload_complete.php


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