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


PHP Fox::getUploadDirectoryUrl方法代码示例

本文整理汇总了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');
     }
 }
开发者ID:UnicodeSystems-PrivateLimited,项目名称:Zendfox,代码行数:14,代码来源:Head.php

示例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;
 }
开发者ID:UnicodeSystems-PrivateLimited,项目名称:Zendfox,代码行数:47,代码来源:Member.php


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