本文整理汇总了PHP中Fox::getUploadDirectoryUrl方法的典型用法代码示例。如果您正苦于以下问题:PHP Fox::getUploadDirectoryUrl方法的具体用法?PHP Fox::getUploadDirectoryUrl怎么用?PHP Fox::getUploadDirectoryUrl使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Fox
的用法示例。
在下文中一共展示了Fox::getUploadDirectoryUrl方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getFavicon
/**
* Get favicon image path
*
* @return string
*/
public function getFavicon()
{
$imgName = Fox::getPreference('web/head/favicon_image');
if ($imgName && file_exists(Fox::getUploadDirectoryPath() . DIRECTORY_SEPARATOR . Fox_Core_Model_Preference::CORE_UPLOAD_FOLDER . DIRECTORY_SEPARATOR . $imgName)) {
return Fox::getUploadDirectoryUrl() . '/' . Fox_Core_Model_Preference::CORE_UPLOAD_FOLDER . '/' . $imgName;
} else {
return $this->themeUrl('images/default_favicon.ico');
}
}
示例2: getResizedMemberImage
/**
* Resize member image
*
* @param string|NULL $img Image name
* @param int $width Target width
* @param int $height Target height
* @return string Returns the url of the resized image
* @throws Exception if member upload directory not found
*/
public function getResizedMemberImage($img = NULL, $width = 100, $height = 100)
{
$image = '';
$resizePath = $width . 'x' . $height;
if ($img != NULL) {
$image = $img;
} else {
if ($this->getMemberImage()) {
$image = $this->getMemberImage();
}
}
$destinationPath = self::ENTITY_TYPE_MEMBER . DIRECTORY_SEPARATOR . $resizePath;
$destinationImagePath = $destinationPath . DIRECTORY_SEPARATOR . $image;
$destinationBasePath = Fox::getUploadDirectoryPath() . DIRECTORY_SEPARATOR;
if (!$image || !file_exists($destinationBasePath . $destinationImagePath)) {
if (!file_exists($destinationBasePath . self::ENTITY_TYPE_MEMBER . DIRECTORY_SEPARATOR . $resizePath)) {
if (!@mkdir($destinationBasePath . self::ENTITY_TYPE_MEMBER . DIRECTORY_SEPARATOR . $resizePath, 0777, TRUE)) {
throw new Exception('"' . $destinationBasePath . self::ENTITY_TYPE_MEMBER . DIRECTORY_SEPARATOR . $resizePath . '" path was not found.');
}
@chmod($destinationBasePath . self::ENTITY_TYPE_MEMBER . DIRECTORY_SEPARATOR . $resizePath, 0777);
}
if ($image && file_exists($destinationBasePath . self::ENTITY_TYPE_MEMBER . DIRECTORY_SEPARATOR . $image)) {
$thumb = new Uni_Util_ImageEditor();
$thumb->resize($destinationBasePath . self::ENTITY_TYPE_MEMBER . DIRECTORY_SEPARATOR . $image, $width, $height, $image, $destinationBasePath . $destinationPath . DIRECTORY_SEPARATOR, false);
@chmod($destinationBasePath . self::ENTITY_TYPE_MEMBER . DIRECTORY_SEPARATOR . $resizePath, 0777);
} else {
$image = 'no-image.png';
$destinationImagePath = $destinationPath . DIRECTORY_SEPARATOR . $image;
if (file_exists($destinationBasePath . self::ENTITY_TYPE_MEMBER . DIRECTORY_SEPARATOR . $image)) {
$thumb = new Uni_Util_ImageEditor();
$thumb->resize($destinationBasePath . self::ENTITY_TYPE_MEMBER . DIRECTORY_SEPARATOR . $image, $width, $height, $image, $destinationBasePath . $destinationPath . DIRECTORY_SEPARATOR, false);
@chmod($destinationBasePath . self::ENTITY_TYPE_MEMBER . DIRECTORY_SEPARATOR . $resizePath, 0777);
}
}
}
$destinationImagePath = str_replace(DIRECTORY_SEPARATOR, "/", $destinationImagePath);
return Fox::getUploadDirectoryUrl() . '/' . $destinationImagePath;
}