本文整理汇总了PHP中UniteFunctionsWPRev::getUrlAttachmentImage方法的典型用法代码示例。如果您正苦于以下问题:PHP UniteFunctionsWPRev::getUrlAttachmentImage方法的具体用法?PHP UniteFunctionsWPRev::getUrlAttachmentImage怎么用?PHP UniteFunctionsWPRev::getUrlAttachmentImage使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类UniteFunctionsWPRev
的用法示例。
在下文中一共展示了UniteFunctionsWPRev::getUrlAttachmentImage方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: initByData
/**
*
* init slide by db record
*/
public function initByData($record)
{
$this->id = $record["id"];
$this->sliderID = $record["slider_id"];
$this->slideOrder = $record["slide_order"];
$params = $record["params"];
$params = (array) json_decode($params);
$layers = $record["layers"];
$layers = (array) json_decode($layers);
$layers = UniteFunctionsRev::convertStdClassToArray($layers);
$imageID = UniteFunctionsRev::getVal($params, "image_id");
//get image url and thumb url
if (!empty($imageID)) {
$this->imageID = $imageID;
$imageUrl = UniteFunctionsWPRev::getUrlAttachmentImage($imageID);
if (empty($imageUrl)) {
$imageUrl = UniteFunctionsRev::getVal($params, "image");
}
$this->imageThumb = UniteFunctionsWPRev::getUrlAttachmentImage($imageID, UniteFunctionsWPRev::THUMB_MEDIUM);
} else {
$imageUrl = UniteFunctionsRev::getVal($params, "image");
}
//set image path, file and url
$this->imageUrl = $imageUrl;
$this->imageFilepath = UniteFunctionsWPRev::getImagePathFromURL($this->imageUrl);
$realPath = UniteFunctionsWPRev::getPathContent() . $this->imageFilepath;
if (file_exists($realPath) == false || is_file($realPath) == false) {
$this->imageFilepath = "";
}
$this->imageFilename = basename($this->imageUrl);
$this->params = $params;
$this->arrLayers = $layers;
}
示例2: getUrlImageThumb
/**
*
* get thumb url
*/
public function getUrlImageThumb()
{
//get image url by thumb
if (!empty($this->imageID)) {
$urlImage = UniteFunctionsWPRev::getUrlAttachmentImage($this->imageID, UniteFunctionsWPRev::THUMB_MEDIUM);
} else {
//get from cache
if (!empty($this->imageFilepath)) {
$urlImage = UniteBaseClassRev::getImageUrl($this->imageFilepath, 200, 100, true);
} else {
$urlImage = $this->imageUrl;
}
}
if (empty($urlImage)) {
$urlImage = $this->imageUrl;
}
return $urlImage;
}