當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。