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


PHP Cloudinary::html_attrs方法代码示例

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


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

示例3: 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");
    }
    return "<img src='" . $source . "' " . Cloudinary::html_attrs($options) . "/>";
}
开发者ID:vanbungkring,项目名称:24custom,代码行数:11,代码来源:cloudinary_api.php

示例4: cl_form_tag

 function cl_form_tag($callback_url, $options = array())
 {
     $form_options = Cloudinary::option_get($options, "form", array());
     $options["callback_url"] = $callback_url;
     $params = Cloudinary\Uploader::build_upload_params($options);
     $params = Cloudinary::sign_request($params, $options);
     $api_url = Cloudinary::cloudinary_api_url("upload", $options);
     $form = "<form enctype='multipart/form-data' action='" . $api_url . "' method='POST' " . Cloudinary::html_attrs($form_options) . ">\n";
     foreach ($params as $key => $value) {
         $form .= "<input " . Cloudinary::html_attrs(array("name" => $key, "value" => $value, "type" => "hidden")) . "/>\n";
     }
     $form .= "</form>\n";
     return $form;
 }
开发者ID:msayagh,项目名称:Quercus-source-code-Maven,代码行数:14,代码来源:Uploader.php


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