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


PHP UTIL_File::getFileSize方法代码示例

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


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

示例1: moveTemporaryFile

 public function moveTemporaryFile($tmpId, $title = '')
 {
     $tmp = BOL_FileTemporaryDao::getInstance()->findById($tmpId);
     $tmpPath = BOL_FileTemporaryService::getInstance()->getTemporaryFilePath($tmpId);
     if (!$tmp) {
         throw new LogicException();
     }
     if (!UTIL_File::validateImage($tmp->filename)) {
         throw new LogicException();
     }
     $image = new BOL_ThemeImage();
     $image->addDatetime = time();
     $image->title = $title;
     $dimensions = getimagesize($tmpPath);
     $image->dimensions = "{$dimensions[0]}x{$dimensions[1]}";
     $image->filesize = UTIL_File::getFileSize($tmpPath);
     $this->themeImageDao->save($image);
     $ext = UTIL_File::getExtension($tmp->filename);
     $imageName = 'theme_image_' . $image->getId() . '.' . $ext;
     $newTempName = $tmp->filename . '.' . $ext;
     rename($tmp->filename, $newTempName);
     OW::getStorage()->copyFile($tmpPath, $this->userfileImagesDir . $imageName);
     if (file_exists($newTempName)) {
         unlink($newTempName);
     }
     BOL_FileTemporaryDao::getInstance()->deleteById($tmpId);
     $image->setFilename($imageName);
     $this->themeImageDao->save($image);
     return $image;
 }
开发者ID:vBulleteen,项目名称:oxwall,代码行数:30,代码来源:theme_service.php

示例2: foreach

foreach ($queryList as $query) {
    try {
        $db->query($query);
    } catch (Exception $e) {
        $logger->addEntry(json_encode($e));
    }
}
$themeService = BOL_ThemeService::getInstance();
$images = $themeService->findAllCssImages();
foreach ($images as $image) {
    try {
        $path = $themeService->getUserfileImagesDir() . $image->getFilename();
        if ($storage->fileExists($path)) {
            if (get_class($storage) == 'UPDATE_AmazonCloudStorage') {
                $tempPath = tempnam($themeService->getUserfileImagesDir(), 'themeTmpImage');
                $info = $storage->copyFileToLocalFS($path, $tempPath);
                $dimensions = getimagesize($tempPath);
                $filesize = UTIL_File::getFileSize($tempPath);
                unlink($tempPath);
            } else {
                $dimensions = getimagesize($path);
                $filesize = UTIL_File::getFileSize($path);
            }
            $image->dimensions = "{$dimensions[0]}x{$dimensions[1]}";
            $image->filesize = $filesize;
            BOL_ThemeImageDao::getInstance()->save($image);
        }
    } catch (Exception $e) {
        $logger->addEntry(json_encode($e));
    }
}
开发者ID:ZyXelP,项目名称:oxwall,代码行数:31,代码来源:update.php


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