• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

PHP formatBytes函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了PHP中formatBytes函数的典型用法代码示例。如果您正苦于以下问题:PHP formatBytes函数的具体用法?PHP formatBytes怎么用?PHP formatBytes使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



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

示例1: getModuleAttachments

 public function getModuleAttachments($module_name, $filter, $page, $size, $order)
 {
     $table_name = ucfirst($module_name) . 'Attachments';
     $_model = D($table_name);
     if (!$order) {
         $order = 'id desc';
     }
     $_model = $_model->where($filter)->order($order);
     if ($page && $size) {
         $_model->page($page, $size);
     }
     $res = $_model->select();
     foreach ($res as $k => $v) {
         if ($module_name == 'user') {
             $res[$k]['related_name'] = '<a target="_blank" href="/user/detail/' . $v["user_id"] . '">' . M("UserRecommends")->where('id=' . $v['user_id'])->getField('name') . '</a>';
         }
         if ($module_name == 'project') {
             $res[$k]['related_name'] = '<a target="_blank" href="/project/detail/' . $v["project_id"] . '">' . M("Projects")->where('id=' . $v['project_id'])->getField('title') . '</a>';
         }
         $res[$k]['create_time'] = substr($res[$k]['create_time'], 0, 16);
         $res[$k]['size'] = formatBytes($res[$k]['size']);
         if ($v['create_user_id'] < 2000) {
             $res[$k]['create_user_name'] = M("Users")->where('id=' . $v['create_user_id'])->getField('realname');
         } else {
             $res[$k]['create_user_name'] = M("UserInfo")->where('id=' . $v['create_user_id'])->getField('name');
         }
     }
     return $res;
 }
开发者ID:Germey,项目名称:yinxingpm,代码行数:29,代码来源:AttachmentsModel.class.php


示例2: writeZIP

function writeZIP($targetDir, $idC, $version)
{
    global $log;
    $zipFile = "Wazzup_{$idC}" . "_" . $version . "_" . MIG_GAME . "_" . date("Ymd") . ".zip";
    // genero nombre para el zip
    $i = 0;
    $existe = TRUE;
    while ($existe === TRUE) {
        if (file_exists(ZIP_DIR . "/{$zipFile}")) {
            $i++;
            //$zipFile = date("Ymd")."_Wazzup_".WAZZUP_WALLPAPER."_$i.zip";
            $zipFile = "Wazzup_{$idC}" . "_" . $version . "_" . MIG_GAME . "_" . date("Ymd") . "_{$i}" . "_" . ".zip";
        } else {
            $existe = FALSE;
        }
    }
    // zipeo y muevo a carpeta de "envios"
    $shellCmd = "cd " . $targetDir . "; zip -r ../../../../" . ZIP_DIR . "/{$zipFile} * ";
    //  echo '<li>Creando ZIP con: ' . $shellCmd.'</li>';
    $log .= exec($shellCmd);
    echo "<li> Zip " . ZIP_DIR . "/{$zipFile} generado exitosamente</li>";
    $ds = filesize(ZIP_DIR . "/{$zipFile}");
    $ds = formatBytes($ds);
    return array('size' => $ds, 'path' => ZIP_DIR . "/{$zipFile}");
}
开发者ID:vallejos,项目名称:samples,代码行数:25,代码来源:functions.php


示例3: DrawUsersList

function DrawUsersList()
{
    global $connection, $config;
    echo "<div class='page-header'><h1>Gestione utenti dispense</h1></div>\n";
    echo "<div class='btn-group'>\n        <button type='button' class='btn btn-success' id='addnewuser'><span class='fa fa-plus'></span> Nuovo</button>\n        <button type='button' class='btn btn-default' id='edituser'><span class='fa fa-edit'></span> Modifica</button>\n        <button type='button' class='btn btn-default' id='enableuser'><span class='fa fa-check'></span> Abilita</button>\n        <button type='button' class='btn btn-default' id='disableuser'><span class='fa fa-ban'></span> Disabilita</button>\n        <button type='button' class='btn btn-danger' id='deletemultiuser'><span class='fa fa-remove'></span> Elimina</button>\n    </div>\n    <br><br>\n    <table class='table table-hover'>\n        <thead><tr>\n            <th>Utente</th>\n            <th>Nome completo</th>\n            <th>Stato</th>\n            <th>Email</th>\n            <th>Spazio usato</th>\n            <th>Spazio massimo</th>\n        </tr></thead>";
    $request = "SELECT * FROM teachers_users ORDER BY user ASC";
    $result = $connection->query($request);
    while ($line = $result->fetch_assoc()) {
        //Draw table row
        $name = $line["user"];
        $fullname = $line["name"];
        $mail = $line["email"];
        if ($line["active"] == 1) {
            $status = "<span class='fa fa-check'></span> Attivo";
        } else {
            $status = "<span class='fa fa-ban'></span> Disabilitato";
        }
        $max_space = formatBytes($line["max_user_space"] * 1073741824);
        $space_percent = intval(getFolderSize("../" . $config->plugin_notes_engine_fpath . "/" . $name) / ($line["max_user_space"] * 1073741824) * 100);
        $space_used = "<div class='progress' style='min-width: 175px;'><div class='progress-bar' role='progressbar' aria-valuenow='{$space_percent}' aria-valuemin='0' aria-valuemax='100' style='width: {$space_percent}%; min-width: 20px;'>{$space_percent}%</div></div>";
        if ($space_percent > 90) {
            $class = "class='danger'";
        } elseif ($space_percent > 80) {
            $class = "class='warning'";
        } else {
            $class = "";
        }
        echo "<tr {$class}>\n            <td><input type='checkbox' id='select-{$name}' value='{$name}'> <a href='index.php?module=notes-engine&arg={$name}'>{$name}</a></td>\n            <td>{$fullname}</td>\n            <td>{$status}</td>\n            <td>{$mail}</td>\n            <td>{$space_used}</td>\n            <td>{$max_space}</td>\n        </tr>";
    }
    echo "</table></div>";
}
开发者ID:borisper1,项目名称:vesi-cms,代码行数:31,代码来源:notes-engine.php


示例4: displayRuns

function displayRuns($resultSet, $title = "")
{
    echo "<div class=\"runTitle\">{$title}</div>\n";
    echo "<table id=\"box-table-a\" class=\"tablesorter\" summary=\"Stats\"><thead><tr><th>Timestamp</th><th>Cpu</th><th>Wall Time</th><th>Peak Memory Usage</th><th>URL</th><th>Simplified URL</th></tr></thead>";
    echo "<tbody>\n";
    while ($row = XHProfRuns_DefaultXHPROFGUI::getNextAssoc($resultSet)) {
        $c_url = urlencode($row['c_url']);
        $url = urlencode($row['url']);
        $html['url'] = htmlentities($row['url'], ENT_QUOTES, 'UTF-8');
        $html['c_url'] = htmlentities($row['c_url'], ENT_QUOTES, 'UTF-8');
        $date = date('M d H:i:s', (int) $row['timestamp']);
        $row['cpu'] = printSeconds($row['cpu']);
        $row['wt'] = printSeconds($row['wt']);
        $row['pmu'] = formatBytes($row['pmu']);
        echo "\t<tr><td><a href=\"?run={$row['id']}\">{$date}</a><br /><span class=\"runid\">(ID: {$row['id']})</span></td><td>{$row['cpu']}</td><td>{$row['wt']}</td><td>{$row['pmu']}</td><td><a href=\"?geturl={$url}\">{$html['url']}</a></td><td><a href=\"?getcurl={$c_url}\">{$html['c_url']}</a></td></tr>\n";
    }
    echo "</tbody>\n";
    echo "</table>\n";
    echo <<<SORTTABLE
<script type="text/javascript">
\$(document).ready(function() 
    { 
        \$("#box-table-a").tablesorter( {sortList: []} ); 
    } 
);
</script>
SORTTABLE;
}
开发者ID:ChrisWesterfield,项目名称:MJR.ONE-CP,代码行数:28,代码来源:common.php


示例5: scriptReturn

function scriptReturn($return, $buffer = false, $json = true)
{
    global $initime;
    if ($buffer) {
        // start and end user output so this can happen without the user waiting
        ob_end_clean();
        header("Connection: close");
        ignore_user_abort();
        // optional
        ob_start();
    }
    if ($json) {
        $return['memory_usage'] = formatBytes(memory_get_usage());
        $return['memory_peak_usage'] = formatBytes(memory_get_peak_usage());
        $return['script_run_time'] = round((microtime(true) - $initime) * 1000);
        header('Content-Type: application/json');
        echo json_encode($return, JSON_NUMERIC_CHECK);
    } else {
        header('Content-Type: text/html');
        echo htmlArray($return);
    }
    if ($buffer) {
        $size = ob_get_length();
        header("Content-Length: {$size}");
        ob_end_flush();
        // Strange behaviour, will not work
        flush();
        // Unless both are called !
    }
}
开发者ID:debruine,项目名称:webmorph,代码行数:30,代码来源:main_func.php


示例6: displayFiles

function displayFiles($path)
{
    echo "<table class='table table-hover file-list'>\n        <thead><th>Nome</th><th>Dimensione</th><th>Ultima modifica</th></thead>";
    $file_array = array_diff(scandir("../" . $path), array('..', '.', '.DS_Store'));
    foreach ($file_array as $file) {
        $url = "../" . $path . "/" . $file;
        if (is_dir($url)) {
            $name = $file;
            $folder_path = $path . "/" . $file;
            $size = formatBytes(getFolderSize($url), 1);
            $date = date("d/m/Y", stat($url)['mtime']);
            echo "<tr><td><span class='fa-stack fa-2x'><i class='fa fa-folder'></i></span> <a href='#' data-path=\"{$folder_path}\" class='file-list-folder'>{$name}</a>";
            echo "<button type='button' class='btn btn-link pull-right lmb remove-folder tooltipped' data-toggle='tooltip' title='Elimina' data-path=\"{$folder_path}\"><i class='fa fa-remove'></i></button>";
            echo "<button type='button' class='btn btn-link pull-right lmb edit-folder tooltipped' data-toggle='tooltip' title='Rinomina' data-path=\"{$folder_path}\"><i class='fa fa-edit'></i></button>";
            echo "</td><td><span class='text-muted'>{$size}</span></td><td><span class='text-muted'>{$date}</span></td></tr>";
        } else {
            $finfo = finfo_open(FILEINFO_MIME_TYPE);
            $content_type = finfo_file($finfo, $url);
            $file_icon = getFileTypeIcon($content_type, $file);
            $size = formatBytes(filesize($url), 1);
            $date = date("d/m/Y", filemtime($url));
            $preview = canPreview($content_type);
            if ($preview == "no") {
                echo "<tr><td><span class='fa-stack fa-2x'><i class='fa {$file_icon}'></i></span> <a href=\"{$url}\" class='file-list' target='_blank'>{$file}</a>";
            } else {
                echo "<tr><td><span class='fa-stack fa-2x'><i class='fa {$file_icon}'></i></span> <a href='#' data-path=\"{$url}\" data-preview_mode='{$preview}' class='file-list-previewable'>{$file}</a>";
            }
            echo "<button type='button' class='btn btn-link pull-right lmb remove-file tooltipped' data-toggle='tooltip' title='Elimina' data-path=\"{$url}\"><i class='fa fa-remove'></i></button>";
            echo "</td><td><span class='text-muted'>{$size}</span></td><td><span class='text-muted'>{$date}</span></td></tr>";
        }
    }
    echo "</table>";
}
开发者ID:borisper1,项目名称:vesi-cms,代码行数:33,代码来源:file-manager.php


示例7: execute

 protected function execute(InputInterface $input, OutputInterface $output)
 {
     // get all thumbnails
     $dir = Asset\Image\Thumbnail\Config::getWorkingDir();
     $thumbnails = array();
     $files = scandir($dir);
     foreach ($files as $file) {
         if (strpos($file, ".xml")) {
             $thumbnails[] = str_replace(".xml", "", $file);
         }
     }
     $allowedThumbs = array();
     if ($input->getOption("thumbnails")) {
         $allowedThumbs = explode(",", $input->getOption("thumbnails"));
     }
     // get only images
     $conditions = array("type = 'image'");
     if ($input->getOption("parent")) {
         $parent = Asset::getById($input->getOption("parent"));
         if ($parent instanceof Asset\Folder) {
             $conditions[] = "path LIKE '" . $parent->getFullPath() . "/%'";
         } else {
             $this->writeError($input->getOption("parent") . " is not a valid asset folder ID!");
             exit;
         }
     }
     $list = new Asset\Listing();
     $list->setCondition(implode(" AND ", $conditions));
     $total = $list->getTotalCount();
     $perLoop = 10;
     for ($i = 0; $i < ceil($total / $perLoop); $i++) {
         $list->setLimit($perLoop);
         $list->setOffset($i * $perLoop);
         $images = $list->load();
         foreach ($images as $image) {
             foreach ($thumbnails as $thumbnail) {
                 if (empty($allowedThumbs) && !$input->getOption("system") || in_array($thumbnail, $allowedThumbs)) {
                     if ($input->getOption("force")) {
                         $image->clearThumbnail($thumbnail);
                     }
                     $this->output->writeln("generating thumbnail for image: " . $image->getFullpath() . " | " . $image->getId() . " | Thumbnail: " . $thumbnail . " : " . formatBytes(memory_get_usage()));
                     $this->output->writeln("generated thumbnail: " . $image->getThumbnail($thumbnail));
                 }
             }
             if ($input->getOption("system")) {
                 $thumbnail = Asset\Image\Thumbnail\Config::getPreviewConfig();
                 if ($input->getOption("force")) {
                     $image->clearThumbnail($thumbnail->getName());
                 }
                 $this->output->writeln("generating thumbnail for image: " . $image->getFullpath() . " | " . $image->getId() . " | Thumbnail: System Preview (tree) : " . formatBytes(memory_get_usage()));
                 $this->output->writeln("generated thumbnail: " . $image->getThumbnail($thumbnail));
             }
         }
         \Pimcore::collectGarbage();
     }
 }
开发者ID:siite,项目名称:choose-sa-cloud,代码行数:56,代码来源:ThumbnailsImageCommand.php


示例8: writeHTMLFiles

/**
 * @param $directory
 * @param $files
 */
function writeHTMLFiles($directory, $files)
{
    echo "Processing " . $directory . "\n";
    $excludeFiles = [".DS_Store", "sign.time", "index.html", "."];
    $contents = <<<END
<html>
<body>
<table>

    <tr>
        <th align='left'>Filename</th>
        <th align='right'>Last modified</th>
        <th align='right' style='padding-left: 100px'>Size</th>
    </tr>

END;
    foreach ($files as $file) {
        //        if ($file === "index.html") {
        //            continue;
        //        }
        //        if ($file === ".") {
        //            continue;
        //        }
        if (in_array($file, $excludeFiles) == true) {
            continue;
        }
        if ($file === "..") {
            $contents .= "<tr><td colspan='3'>";
            $contents .= "<a href='..'>Parent Directory</a>";
            $contents .= "</td></tr>";
        } else {
            $contents .= "<tr><td>";
            $filename = $directory . '/' . $file;
            $file = htmlentities($file);
            $contents .= "<a href='{$file}'>{$file}</a>";
            $contents .= "</td><td>";
            $contents .= date("j-M-Y H:i", filemtime($filename));
            $contents .= "</td><td align='right'>";
            if (is_dir($filename) == false) {
                $contents .= formatBytes(filesize($filename));
            }
            $contents .= "</td></tr>";
        }
    }
    $contents .= <<<END
    
    </table>
    
</body>
</html>

END;
    file_put_contents($directory . "/index.html", $contents);
}
开发者ID:itnihao,项目名称:BastionRPM,代码行数:58,代码来源:makeHTML.php


示例9: execute

 protected function execute(InputInterface $input, OutputInterface $output)
 {
     // disable versioning
     Version::disable();
     // get all thumbnails
     $thumbnails = [];
     $list = new Asset\Video\Thumbnail\Config\Listing();
     $items = $list->load();
     foreach ($items as $item) {
         $thumbnails[] = $item->getName();
     }
     $allowedThumbs = array();
     if ($input->getOption("thumbnails")) {
         $allowedThumbs = explode(",", $input->getOption("thumbnails"));
     }
     // get only images
     $conditions = array("type = 'video'");
     if ($input->getOption("parent")) {
         $parent = Asset::getById($input->getOption("parent"));
         if ($parent instanceof Asset\Folder) {
             $conditions[] = "path LIKE '" . $parent->getFullPath() . "/%'";
         } else {
             $this->writeError($input->getOption("parent") . " is not a valid asset folder ID!");
             exit;
         }
     }
     $list = new Asset\Listing();
     $list->setCondition(implode(" AND ", $conditions));
     $total = $list->getTotalCount();
     $perLoop = 10;
     for ($i = 0; $i < ceil($total / $perLoop); $i++) {
         $list->setLimit($perLoop);
         $list->setOffset($i * $perLoop);
         $videos = $list->load();
         foreach ($videos as $video) {
             foreach ($thumbnails as $thumbnail) {
                 if (empty($allowedThumbs) && !$input->getOption("system") || in_array($thumbnail, $allowedThumbs)) {
                     $this->output->writeln("generating thumbnail for video: " . $video->getFullpath() . " | " . $video->getId() . " | Thumbnail: " . $thumbnail . " : " . formatBytes(memory_get_usage()));
                     $video->getThumbnail($thumbnail);
                     $this->waitTillFinished($video->getId(), $thumbnail);
                 }
             }
             if ($input->getOption("system")) {
                 $this->output->writeln("generating thumbnail for video: " . $video->getFullpath() . " | " . $video->getId() . " | Thumbnail: System Preview : " . formatBytes(memory_get_usage()));
                 $thumbnail = Asset\Video\Thumbnail\Config::getPreviewConfig();
                 $video->getThumbnail($thumbnail);
                 $this->waitTillFinished($video->getId(), $thumbnail);
             }
         }
     }
 }
开发者ID:emanuel-london,项目名称:pimcore,代码行数:51,代码来源:ThumbnailsVideoCommand.php


示例10: savePhoto

 /**
  * From ajax
  */
 public function savePhoto()
 {
     $response = ['code' => 0, 'message' => trans('photo.error', ['size' => formatBytes()]), 'url' => ''];
     if (\Request::hasFile('image')) {
         if (!$this->photoRepository->imagesMetSizes(\Input::file('image'))) {
             return json_encode($response);
         }
         $user = $this->userRepository->changeAvatar(\Input::file('image'));
         if ($user) {
             $response['code'] = 1;
             $response['url'] = $user->present()->getAvatar(100);
         }
     }
     return json_encode($response);
 }
开发者ID:adamendvy89,项目名称:intifadah,代码行数:18,代码来源:UserGetstartedController.php


示例11: uploadBg

 /**
  * Ajax serving
  */
 public function uploadBg()
 {
     $error = json_encode(['response' => 0, 'message' => trans('photo.error', ['size' => formatBytes()])]);
     if (\Request::hasFile('image')) {
         if (!$this->photoRepository->imagesMetSizes(\Input::file('image'))) {
             return $error;
         }
         if ($image = $this->userRepository->changeDesignBg(\Input::file('image'), \Input::get('val.bg_image'))) {
             return json_encode(['response' => 1, 'image' => \Image::url($image), 'imagePath' => $image]);
         } else {
             return $error;
         }
     }
     return $error;
 }
开发者ID:weddingjuma,项目名称:world,代码行数:18,代码来源:AccountController.php


示例12: execute

 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $files = rscandir(PIMCORE_TEMPORARY_DIRECTORY . "/image-thumbnails/");
     $savedBytesTotal = 0;
     foreach ($files as $file) {
         if (file_exists($file)) {
             $originalFilesize = filesize($file);
             \Pimcore\Image\Optimizer::optimize($file);
             $savedBytes = $originalFilesize - filesize($file);
             $savedBytesTotal += $savedBytes;
             $this->output->writeln("Optimized image: " . $file . " saved " . formatBytes($savedBytes));
         }
     }
     $this->output->writeln("Finished!");
     $this->output->writeln("Saved " . formatBytes($savedBytesTotal) . " in total");
 }
开发者ID:solverat,项目名称:pimcore,代码行数:16,代码来源:ThumbnailsOptimizeImagesCommand.php


示例13: show_database

function show_database()
{
    $db_size = 0;
    echo "<h3>Status:</h3>";
    $result = mysql_query("SHOW TABLE STATUS");
    if ($result) {
        while ($row = mysql_fetch_array($result)) {
            $db_size += $row['Index_length'];
            $db_size += $row['Data_length'];
        }
        echo "<p>The Grinder Server database '" . htmlentities(database_get_name(), ENT_QUOTES) . "' is currently " . htmlentities(formatBytes($db_size), ENT_QUOTES) . " in size.</p>";
        mysql_free_result($result);
    }
    echo "<h3>Purge Database:</h3>";
    echo "<p>Purge all crashes and nodes from the database.</p>";
    echo "<div id='purge_db_button'>Purge</div>";
}
开发者ID:ZionOps,项目名称:grinder,代码行数:17,代码来源:settings.php


示例14: changePhoto

 public function changePhoto()
 {
     $id = \Input::get('id');
     $game = $this->gameRepository->get($id);
     $response = ['code' => 0, 'message' => trans('photo.error', ['size' => formatBytes()]), 'url' => ''];
     if (\Request::hasFile('image')) {
         if (!$this->photoRepository->imagesMetSizes(\Input::file('image'))) {
             return json_encode($response);
         }
         $image = $this->gameRepository->changePhoto(\Input::file('image'), $game);
         if ($image) {
             $response['code'] = 1;
             $response['url'] = \Image::url($image, 100);
         }
     }
     return json_encode($response);
 }
开发者ID:weddingjuma,项目名称:world,代码行数:17,代码来源:GameController.php


示例15: listFiles

function listFiles($prefix)
{
    date_default_timezone_set('UTC');
    $location = "../download/product";
    echo "<!-- listing files in {$location} with prefix {$prefix} -->";
    if (false != ($dir = opendir($location))) {
        while (false != ($file = readdir($dir))) {
            if ($file != "." and $file != ".." and $file != "index.php") {
                $files[] = $location . "/" . $file;
                // put in array.
            }
        }
        closedir($dir);
    } else {
        $location = "../../download/product";
        if (false != ($dir = opendir($location))) {
            while (false != ($file = readdir($dir))) {
                if ($file != "." and $file != ".." and $file != "index.php") {
                    $files[] = $location . "/" . $file;
                    // put in array.
                }
            }
            closedir($dir);
        }
    }
    rsort($files);
    $count = 0;
    foreach ($files as $file) {
        if ($count < 5) {
            $refname = basename($file);
            if (substr($refname, 0, strlen($prefix)) == $prefix) {
                $count = $count + 1;
                $stat = stat($file);
                $date = date('Y-m-d', $stat['mtime']);
                $size = formatBytes($stat['size']);
                echo "<tr class='clickable'>";
                echo "<td class='text-center'>{$date}</td>";
                echo "<td><a href='http://eclipse.baeyens.it/download/product/{$refname}' target='_blank'><i class='glyphicon glyphicon-cloud-download'></i> {$refname}</a></td>";
                echo "<td class='text-right'>{$size}</td>";
                echo "</tr>";
            }
        }
    }
}
开发者ID:heman4t,项目名称:arduino-eclipse-plugin,代码行数:44,代码来源:file-list.php


示例16: show

/**
* Ließt den Seiteninhalt der übergebenen ID aus der Datenbank aus
*/
function show($id)
{
    global $mysql, $content;
    $id = intval($id);
    $qPage = $mysql->query("SELECT * FROM " . _PREFIX_ . "pages WHERE id='" . $id . "'");
    $oPage = mysql_fetch_object($qPage);
    $content->pagetitle = $oPage->title;
    $pageContent = stripslashes(base64_decode($oPage->content));
    if (0 < mysql_result($mysql->query("SELECT count(*) FROM " . _PREFIX_ . "rel_pf WHERE page='" . $id . "'"), 0)) {
        $qFile = $mysql->query("SELECT " . _PREFIX_ . "files.*\r\n\t\t\t\t\t\tFROM " . _PREFIX_ . "files, " . _PREFIX_ . "rel_pf\r\n\t\t\t\t\t\tWHERE\r\n\t\t\t\t\t\t\t" . _PREFIX_ . "rel_pf.page = " . $id . "\r\n\t\t\t\t\t\tAND\r\n\t\t\t\t\t\t\t" . _PREFIX_ . "files.id = " . _PREFIX_ . "rel_pf.file\r\n\t\t\t\t\t\tORDER BY\r\n\t\t\t\t\t\t\t" . _PREFIX_ . "files.name");
        $token = @file_get_contents(dirname(__FILE__) . "/template/attachment.token.tpl");
        $tpl = @file_get_contents(dirname(__FILE__) . "/template/attachment.tpl");
        while ($o = mysql_fetch_object($qFile)) {
            $data .= str_replace(array("%link%", "%title%", "%description%", "%filesize%"), array(UPLOAD_DIR . $o->file, $o->name, $o->description, formatBytes(filesize(UPLOAD_DIR . $o->file))), $token);
        }
    }
    $returnVal = $pageContent . str_replace("%attachment%", $data, $tpl);
    return $returnVal;
}
开发者ID:nubix,项目名称:cms,代码行数:22,代码来源:exec.php


示例17: status

 function status(&$curBytes, &$totalBytes)
 {
     $minfo = apc_sma_info();
     $cinfo = apc_cache_info('user');
     foreach ($minfo['block_lists'] as $c) {
         $blocks[] = count($c);
     }
     $curBytes = $minfo['seg_size'] - $minfo['avail_mem'];
     $totalBytes = $minfo['seg_size'];
     $return[] = array('name' => '子系统运行时间', 'value' => timeLength(time() - $cinfo['start_time']));
     $return[] = array('name' => '可用内存', 'value' => formatBytes($minfo['avail_mem']) . ' / ' . formatBytes($minfo['seg_size']));
     $return[] = array('name' => '内存使用方式', 'value' => $cinfo['memory_type']);
     $return[] = array('name' => '内存数据段', 'value' => $minfo['num_seg'] . '块 (' . implode(',', $blocks) . ')');
     $return[] = array('name' => '缓存命中', 'value' => $cinfo['num_hits'] . '次');
     $return[] = array('name' => '缓存未命中', 'value' => $cinfo['num_misses'] . '次');
     $return[] = array('name' => '已缓存数据条数', 'value' => $cinfo['num_entries'] . '条');
     $return[] = array('name' => '数据锁定方式', 'value' => $cinfo['locking_type']);
     return $return;
 }
开发者ID:dalinhuang,项目名称:shopexts,代码行数:19,代码来源:cacheApc.php


示例18: status

 function status(&$curBytes, &$totalBytes)
 {
     $info = $this->obj->getStats();
     $curBytes = $info['bytes'];
     $totalBytes = $info['limit_maxbytes'];
     $return[] = array('name' => '子系统运行时间', 'value' => timeLength($info['uptime']));
     $return[] = array('name' => '缓存服务器', 'value' => MEMCACHED_HOST . ':' . MEMCACHED_PORT . " (ver:{$info['version']})");
     $return[] = array('name' => '数据读取', 'value' => $info['cmd_get'] . '次 ' . formatBytes($info['bytes_written']));
     $return[] = array('name' => '数据写入', 'value' => $info['cmd_set'] . '次 ' . formatBytes($info['bytes_read']));
     $return[] = array('name' => '缓存命中', 'value' => $info['get_hits'] . '次');
     $return[] = array('name' => '缓存未命中', 'value' => $info['get_misses'] . '次');
     $return[] = array('name' => '已缓存数据条数', 'value' => $info['curr_items'] . '条');
     $return[] = array('name' => '进程数', 'value' => $info['threads']);
     $return[] = array('value' => $info['pid'], 'name' => '服务器进程ID');
     $return[] = array('value' => $info['rusage_user'], 'name' => '该进程累计的用户时间(秒:微妙)');
     $return[] = array('value' => $info['rusage_system'], 'name' => '该进程累计的系统时间(秒:微妙)');
     $return[] = array('value' => $info['curr_items'], 'name' => '服务器当前存储的内容数量');
     $return[] = array('value' => $info['total_items'], 'name' => '服务器启动以来存储过的内容总数');
     //    $return[] = array('value'=>$info['curr_connections'],'name'=>'连接数量');
     //    $return[] = array('value'=>$info['total_connections'],'name'=>'服务器运行以来接受的连接总数 ');
     //    $return[] = array('value'=>$info['connection_structures'],'name'=>'服务器分配的连接结构的数量');
     return $return;
 }
开发者ID:dalinhuang,项目名称:shopexts,代码行数:23,代码来源:memcached.php


示例19: uploadCover

 public function uploadCover()
 {
     $failed = json_encode(['status' => 'error', 'message' => trans('photo.error', ['size' => formatBytes()])]);
     if (!\Input::hasFile('image')) {
         return $failed;
     }
     $file = \Input::file('image');
     if (!$this->photo->imagesMetSizes($file)) {
         return $failed;
     }
     $path = $file->getRealPath();
     list($width, $height) = getimagesize($path);
     $result = json_encode(['status' => 'error', 'message' => 'Failed to process image, supported type jpg,jpeg,gif,png']);
     //let use direct upload like that
     $imageRepo = $this->photo->image;
     $image = $imageRepo->load($file)->setPath('temp/')->offCdn();
     $image = $image->resize(1000, null, 'fill', 'any');
     if ($image->hasError()) {
         return $result;
     }
     $image = $image->result();
     $image = str_replace('%d', '1000', $image);
     if ($image) {
         list($width, $height) = getimagesize(base_path() . '/' . $image);
         //delete old images
         $user = \Auth::user();
         if ($user->original_cover) {
             \Image::delete($user->original_cover);
         }
         if ($user->cover) {
             \Image::delete($user->cover);
         }
         $this->userRepository->updateCover($image, null, true);
         return json_encode(['status' => 'success', 'url' => \URL::to($image)]);
     }
     return $result;
 }
开发者ID:weddingjuma,项目名称:world,代码行数:37,代码来源:ProfileController.php


示例20: uploadCover

 public function uploadCover()
 {
     $failed = json_encode(['status' => 'error', 'message' => trans('photo.error', ['size' => formatBytes()])]);
     if (!\Input::hasFile('img')) {
         return $failed;
     }
     $file = \Input::file('img');
     if (!$this->photo->imagesMetSizes($file)) {
         return $failed;
     }
     $path = $file->getRealPath();
     list($width, $height) = getimagesize($path);
     $result = json_encode(['status' => 'error', 'message' => 'Insufficient image width/Height, MinWidth : 200px and MinHeight :  100px']);
     if ($width < 200 or $height < 100) {
         return $result;
     }
     if ($width < 1000) {
         //let use direct upload like that
         $imageRepo = $this->photo->image;
         $image = $imageRepo->load($file)->setPath('temp/')->offCdn();
         $image = $image->resize(1000, 500, 'fill', 'up');
         //if ($image->hasError()) return $result;
         $image = $image->result();
         $image = str_replace('%d', '1000', $image);
     } else {
         $image = $this->photo->upload($file, ['path' => 'temp/', 'width' => 1000, 'fit' => 'inside', 'scale' => 'down', 'cdn' => false]);
         if (!$image) {
             return $result;
         }
         $image = str_replace('_%d_', '_1000_', $image);
     }
     if ($image) {
         list($width, $height) = getimagesize(base_path() . '/' . $image);
         return json_encode(['status' => 'success', 'url' => \URL::to($image)]);
     }
     return $result;
 }
开发者ID:adamendvy89,项目名称:intifadah,代码行数:37,代码来源:ProfileController.php



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP formatCiscoHardware函数代码示例发布时间:2022-05-15
下一篇:
PHP format4Datepicker函数代码示例发布时间:2022-05-15
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap