本文整理汇总了PHP中Api::getCdnUri方法的典型用法代码示例。如果您正苦于以下问题:PHP Api::getCdnUri方法的具体用法?PHP Api::getCdnUri怎么用?PHP Api::getCdnUri使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Api
的用法示例。
在下文中一共展示了Api::getCdnUri方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getScriptSrc
/**
* Return url for javascript widget.
* If no version is provided method will use default(current) version
*
* @param string $version Version of Uploadcare.com widget
* @return string
*/
public function getScriptSrc($version = null)
{
if (!$version) {
$version = self::version;
}
return sprintf($this->api->getCdnUri() . '/widget/%s/uploadcare/uploadcare.full.min.js', $version);
}
示例2: getScriptSrc
/**
* Return url for javascript widget.
* If no version is provided method will use default(current) version
*
* @param string $version Version of Uploadcare.com widget
* @return string
*/
public function getScriptSrc($version = null, $full = true)
{
if (!$version) {
$version = self::version;
}
if ($full) {
$tail = "uploadcare.full.min.js";
} else {
$tail = "uploadcare.min.js";
}
return sprintf($this->api->getCdnUri() . '/widget/%s/uploadcare/' . $tail, $version);
}
示例3: getUrl
/**
* Get url of original image
*
* @param string $postfix
* @return string
*/
public function getUrl($postfix = null)
{
$url = sprintf('%s/%s/', $this->api->getCdnUri(), $this->uuid);
if ($this->default_effects) {
$url = sprintf('%s-/%s', $url, $this->default_effects);
}
if ($this->filename && $postfix === null) {
$postfix = $this->filename;
}
$operations = array();
foreach ($this->operations as $i => $operation_item) {
$part = array();
foreach (array_keys($operation_item) as $operation_type) {
$operation_params = $operation_item[$operation_type];
$part[] = $operation_type;
switch ($operation_type) {
case 'crop':
$part = $this->__addPartSize($part, $operation_params);
$part = $this->__addPartCenter($part, $operation_params);
$part = $this->__addPartFillColor($part, $operation_params);
break;
case 'resize':
$part = $this->__addPartSize($part, $operation_params);
break;
case 'scale_crop':
$part = $this->__addPartSize($part, $operation_params);
$part = $this->__addPartCenter($part, $operation_params);
break;
case 'effect':
$part = $this->__addPartEffect($part, $operation_params);
break;
case 'preview':
$part = $this->__addPartSize($part, $operation_params);
break;
case 'custom':
$part = array($operation_params);
break;
}
$part_str = join('/', $part);
$operations[] = $part_str;
}
}
if (count($operations)) {
$operations_part = join('/-/', $operations);
return $url . '-/' . $operations_part . '/' . $postfix;
} else {
return $url . $postfix;
}
}