本文整理汇总了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);
}
示例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);
}
示例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;
}
示例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();
}
}
}
}
}