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


PHP UploadedFile::fileNameToPath方法代码示例

本文整理汇总了PHP中UploadedFile::fileNameToPath方法的典型用法代码示例。如果您正苦于以下问题:PHP UploadedFile::fileNameToPath方法的具体用法?PHP UploadedFile::fileNameToPath怎么用?PHP UploadedFile::fileNameToPath使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在UploadedFile的用法示例。


在下文中一共展示了UploadedFile::fileNameToPath方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: realImgSrc

 public static function realImgSrc($imgSrc, $type = "main", $size = "normal", $title = '')
 {
     if ($imgSrc) {
         $path = "/uploads/images_thumbs/" . UploadedFile::fileNameToPath($imgSrc);
     } else {
         $imgSrc = "DefaultMainPhoto.jpg";
         $path = "/templates/arfooo/images/";
     }
     switch ($size) {
         case "small":
             $imgSrc = "s" . $imgSrc;
             break;
         case "medium":
             $imgSrc = "m" . $imgSrc;
             break;
         case "nano":
             $imgSrc = "n" . $imgSrc;
             break;
     }
     if ($title) {
         $path .= NameTool::strToAscii($title) . '-';
     }
     $imgSrc = $path . $imgSrc;
     return AppRouter::getResourceUrl($imgSrc);
 }
开发者ID:reinfire,项目名称:arfooo,代码行数:25,代码来源:AppTemplateLiteView.php

示例2: deleteSitePhotoFiles

 function deleteSitePhotoFiles($src)
 {
     if (empty($src)) {
         return;
     }
     $dirPath = Config::get("SITES_THUMBS_PATH") . UploadedFile::fileNameToPath($src);
     $this->deleteFileIfExists($dirPath . "s" . $src);
     $this->deleteFileIfExists($dirPath . "m" . $src);
     $this->deleteFileIfExists($dirPath . "n" . $src);
     $this->deleteFileIfExists($dirPath . $src);
 }
开发者ID:reinfire,项目名称:arfooo,代码行数:11,代码来源:PhotoModel.php

示例3: createDirsToFile

 public static function createDirsToFile($path, $fileName)
 {
     $currentPath = $path;
     $dirs = array_slice(explode("/", UploadedFile::fileNameToPath($fileName)), 0, -1);
     foreach ($dirs as $dir) {
         $currentPath .= $dir . "/";
         if (!is_dir($currentPath)) {
             $oldMask = umask(0);
             mkdir($currentPath, 0777);
             umask($oldMask);
         }
     }
     return $currentPath;
 }
开发者ID:reinfire,项目名称:arfooo,代码行数:14,代码来源:UploadedFile.php

示例4: getThumbnailSrc

 function getThumbnailSrc($canBeOverwrittenByGalleryImage = true)
 {
     if ($canBeOverwrittenByGalleryImage && (empty($this->url) || Config::get("firstGalleryImageForThumbEnabled") && $this->firstGalleryImageSrc)) {
         if ($this->firstGalleryImageSrc) {
             return AppRouter::getResourceUrl("/uploads/images_thumbs/" . UploadedFile::fileNameToPath($this->firstGalleryImageSrc) . 's' . $this->firstGalleryImageSrc);
         } else {
             return $this->getDefaultImageSrc();
         }
     }
     $siteId = $this->siteId;
     if ($this->imageSrc) {
         return AppRouter::getResourceUrl("/uploads/images_thumbs/" . $this->imageSrc);
     } else {
         if (empty($this->url)) {
             return $this->getDefaultImageSrc();
         } else {
             if (Config::get('cacheSiteImagesEnabled') == 1) {
                 $fileName = $siteId . '.jpg';
                 $filePath = Config::get("SITES_THUMBS_PATH") . $fileName;
                 if (file_exists($filePath)) {
                     return AppRouter::getResourceUrl("/uploads/images_thumbs/" . $fileName);
                 } else {
                     return AppRouter::getRewrittedUrl("/site/getThumb/" . $siteId);
                 }
             } else {
                 if (Config::get("thumbsGeneratorUrl")) {
                     return $this->getThumbGeneratorSiteUrl();
                 } else {
                     return $this->getDefaultImageSrc();
                 }
             }
         }
     }
 }
开发者ID:reinfire,项目名称:arfooo,代码行数:34,代码来源:SiteModel.php


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