本文整理汇总了PHP中Cloudinary::finalize_resource_type方法的典型用法代码示例。如果您正苦于以下问题:PHP Cloudinary::finalize_resource_type方法的具体用法?PHP Cloudinary::finalize_resource_type怎么用?PHP Cloudinary::finalize_resource_type使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Cloudinary
的用法示例。
在下文中一共展示了Cloudinary::finalize_resource_type方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: cloudinary_url
public static function cloudinary_url($source, &$options = array())
{
$source = self::check_cloudinary_field($source, $options);
$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"));
$secure_cdn_subdomain = Cloudinary::option_consume($options, "secure_cdn_subdomain", Cloudinary::config_get("secure_cdn_subdomain"));
$cname = Cloudinary::option_consume($options, "cname", Cloudinary::config_get("cname"));
$shorten = Cloudinary::option_consume($options, "shorten", Cloudinary::config_get("shorten"));
$sign_url = Cloudinary::option_consume($options, "sign_url", Cloudinary::config_get("sign_url"));
$api_secret = Cloudinary::option_consume($options, "api_secret", Cloudinary::config_get("api_secret"));
$url_suffix = Cloudinary::option_consume($options, "url_suffix", Cloudinary::config_get("url_suffix"));
$use_root_path = Cloudinary::option_consume($options, "use_root_path", Cloudinary::config_get("use_root_path"));
if (!$private_cdn and !empty($url_suffix)) {
throw new InvalidArgumentException("URL Suffix only supported in private CDN");
}
if (!$source) {
return $source;
}
if (preg_match("/^https?:\\//i", $source)) {
if ($type == "upload") {
return $source;
}
}
$resource_type_and_type = Cloudinary::finalize_resource_type($resource_type, $type, $url_suffix, $use_root_path, $shorten);
$sources = Cloudinary::finalize_source($source, $format, $url_suffix);
$source = $sources["source"];
$source_to_sign = $sources["source_to_sign"];
if (strpos($source_to_sign, "/") && !preg_match("/^https?:\\//", $source_to_sign) && !preg_match("/^v[0-9]+/", $source_to_sign) && empty($version)) {
$version = "1";
}
$version = $version ? "v" . $version : NULL;
$signature = NULL;
if ($sign_url) {
$to_sign = implode("/", array_filter(array($transformation, $source_to_sign)));
$signature = str_replace(array('+', '/', '='), array('-', '_', ''), base64_encode(sha1($to_sign . $api_secret, TRUE)));
$signature = 's--' . substr($signature, 0, 8) . '--';
}
$prefix = Cloudinary::unsigned_download_url_prefix($source, $cloud_name, $private_cdn, $cdn_subdomain, $secure_cdn_subdomain, $cname, $secure, $secure_distribution);
return preg_replace("/([^:])\\/+/", "\$1/", implode("/", array_filter(array($prefix, $resource_type_and_type, $signature, $transformation, $version, $source))));
}