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

PHP formatfilesize函数代码示例

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

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



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

示例1: recursive_directory_size

function recursive_directory_size($directory, $format = FALSE)
{
    $size = 0;
    if (substr($directory, -1) == '/') {
        $directory = substr($directory, 0, -1);
    }
    if (!file_exists($directory) || !is_dir($directory) || !is_readable($directory)) {
        return -1;
    }
    if ($handle = opendir($directory)) {
        while (($file = readdir($handle)) !== false) {
            $path = $directory . '/' . $file;
            if ($file != '.' && $file != '..') {
                if (is_file($path)) {
                    $size += filesize($path);
                } elseif (is_dir($path)) {
                    $handlesize = recursive_directory_size($path);
                    if ($handlesize >= 0) {
                        $size += $handlesize;
                    } else {
                        return -1;
                    }
                }
            }
        }
        closedir($handle);
    }
    if ($format == TRUE) {
        return formatfilesize($size);
    } else {
        return $size;
    }
}
开发者ID:wildanSawaludin,项目名称:ci-cms,代码行数:33,代码来源:dashboard_helper.php


示例2: number_format

echo $lang["searchitemsdiskusage"];
?>
</h1>

<div class="Question">
<label><?php 
echo $lang["matchingresourceslabel"];
?>
</label>
<div class="Fixed"><?php 
echo number_format($count);
?>
</div>
<div class="clearerleft"></div>
</div>

<div class="Question">
<label><?php 
echo $lang["diskusage"];
?>
</label>
<div class="Fixed"><strong> <?php 
echo formatfilesize($disk_usage);
?>
</strong></div>
<div class="clearerleft"></div>
</div>


<?php 
include "../include/footer.php";
开发者ID:perryrothjohnson,项目名称:resourcespace,代码行数:31,代码来源:search_disk_usage.php


示例3: resize

function resize($filename, $resize_width, $resize_height, $texttype = false, $filename_src)
{
    global $config, $_POST, $error;
    $ext = strtolower(strrchr(basename($filename), "."));
    // Получаем формат уменьшаемого изображения
    $info = getimagesize($filename);
    // Возвращает ширину и высоту картинки
    $width = $info['0'];
    $height = $info['1'];
    if ($resize_height > $height or $resize_width > $width) {
        $error[] = "Нельзя уменьшать изображение в большую сторону";
    } else {
        list($resize_width, $resize_height) = get_resize_proportions($height, $width, $resize_height, $resize_width);
        $type = '';
        if (!$info['mime']) {
            switch ($ext) {
                case '.gif':
                    $type = 'gif';
                    break;
                case '.png':
                    $type = 'png';
                    break;
                case '.jpg':
                    $type = 'jpg';
                    break;
                case '.jpeg':
                    $type = 'jpg';
                    break;
                    //case '.bmp' : $type='bmp'; break; - здесь уже не должно быть BMP
            }
        } else {
            switch ($info['mime']) {
                case 'image/gif':
                    $type = 'gif';
                    break;
                case 'image/pjpeg':
                    $type = 'jpg';
                    break;
                case 'image/jpeg':
                    $type = 'jpg';
                    break;
                case 'image/x-png':
                    $type = 'png';
                    break;
                case 'image/png':
                    $type = 'png';
                    break;
                    //case 'image/bmp'  : $type='bmp'; break;  - здесь уже не должно быть BMP
                    //case 'image/x-ms-bmp' : $type='bmp'; break;
            }
        }
        if ($type != '') {
            include_once 'gdenhancer/GDEnhancer.php';
            //path of GDEnhancer.php
            $image = new GDEnhancer($filename);
            $image->backgroundResize($resize_width, $resize_height, 'shrink');
            //option shrink
            //текст на превью
            if (isset($texttype) and $texttype and $texttype != "nothing") {
                $filesize = formatfilesize(filesize($filename));
                if ($texttype == 'dimensions') {
                    $text = $width . 'x' . $height . '(' . $filesize . ')';
                } else {
                    $text = $_POST['text'];
                }
                $DARKNESS = 70;
                //FIXME: вынести в конфиг!
                //"полупрозрачный" слой подложки под текст
                $imglayer = imagecreatetruecolor($width, 15);
                imagesavealpha($imglayer, true);
                $color = imagecolorallocatealpha($imglayer, 0, 0, 0, $DARKNESS);
                imagefill($imglayer, 0, 0, $color);
                ob_start();
                imagepng($imglayer);
                $image_data = ob_get_contents();
                ob_end_clean();
                imagedestroy($imglayer);
                $image->layerImage($image_data);
                $image->layerMove(0, "top", 0, $resize_height - 15);
                $save = $image->save();
                unset($image);
                //сам текст
                $image = new GDEnhancer($save['contents']);
                $image->layerText($text, $config['site_dir'] . "/K1FS.ttf", '10', '#FFFFFF', 0, 1);
                $image->layerMove(0, "top", 2, $resize_height - 14);
            }
            $save = $image->save();
            file_put_contents($filename, $save['contents']);
            unset($image);
        }
    }
    //else resize_height>height
}
开发者ID:feeel1,项目名称:akina,代码行数:93,代码来源:functions.php


示例4: htmlspecialchars

	<!--List Item-->
	<tr>
	<td><?php 
    echo htmlspecialchars($files[$n]["name"]);
    ?>
</td>	
	<td><?php 
    echo htmlspecialchars($files[$n]["description"]);
    ?>
&nbsp;</td>	
	<td><?php 
    echo $files[$n]["file_extension"] == "" ? $lang["notuploaded"] : htmlspecialchars(str_replace_formatted_placeholder("%extension", $files[$n]["file_extension"], $lang["cell-fileoftype"]));
    ?>
</td>	
	<td><?php 
    echo formatfilesize($files[$n]["file_size"]);
    ?>
</td>	
	<td><?php 
    echo nicedate($files[$n]["creation_date"], true);
    ?>
</td>
	<?php 
    if (count($alt_types) > 1) {
        ?>
<td><?php 
        echo $files[$n]["alt_type"];
        ?>
</td><?php 
    }
    ?>
开发者ID:perryrothjohnson,项目名称:resourcespace,代码行数:31,代码来源:alternative_files.php


示例5: sql_query

# get all resources in the DB
$resources = sql_query("select ref,field" . $view_title_field . ",file_extension from resource where ref>0 order by ref DESC");
//loop:
foreach ($resources as $resource) {
    $resource_path = get_resource_path($resource['ref'], true, "", false, $resource['file_extension']);
    if (file_exists($resource_path)) {
        $filesize = filesize_unlimited($resource_path);
        sql_query("update resource_dimensions set file_size={$filesize} where resource='" . $resource['ref'] . "'");
        echo "Ref: " . $resource['ref'] . " - " . $resource['field' . $view_title_field] . " - updating resource_dimensions file_size column - " . formatfilesize($filesize);
        echo "<br />";
    }
    $alt_files = sql_query("select file_extension,file_name,ref from resource_alt_files where resource=" . $resource['ref']);
    if (count($alt_files) > 0) {
        foreach ($alt_files as $alt) {
            $alt_path = get_resource_path($resource['ref'], true, "", false, $alt['file_extension'], -1, 1, false, "", $alt['ref']);
            if (file_exists($alt_path)) {
                // allow to re-run script without re-copying files
                $filesize = filesize_unlimited($alt_path);
                sql_query("update resource_alt_files set file_size={$filesize} where resource='" . $resource['ref'] . "' and ref='" . $alt['ref'] . "'");
                echo "&nbsp;&nbsp;&nbsp;&nbsp;ALT - " . $alt['file_name'] . " - updating alt file size - " . formatfilesize($filesize);
                echo "<br />";
            }
        }
    }
    update_disk_usage($resource['ref']);
    echo "updating disk usage";
    echo "<br />";
    echo "<br />";
    flush();
    ob_flush();
}
开发者ID:perryrothjohnson,项目名称:resourcespace,代码行数:31,代码来源:update_resource_file_sizes.php


示例6: get_resource_path

<div class="Fixed">
<?php
if ($resource["has_image"]==1)
	{
	?><img align="top" src="<?php echo get_resource_path($ref,false,($edit_large_preview?"pre":"thm"),false,$resource["preview_extension"],-1,1,checkperm("w"))?>" class="ImageBorder" style="margin-right:10px;"/><br />
	<?php
	}
else
	{
	# Show the no-preview icon
	?>
	<img src="../gfx/<?php echo get_nopreview_icon($resource["resource_type"],$resource["file_extension"],true)?>" />
	<br />
	<?php
	}
if ($resource["file_extension"]!="") { ?><strong><?php echo str_replace_formatted_placeholder("%extension", $resource["file_extension"], $lang["cell-fileoftype"]) . " (" . formatfilesize(@filesize_unlimited(get_resource_path($ref,true,"",false,$resource["file_extension"]))) . ")" ?></strong><br /><?php } ?>

	<?php if ($resource["has_image"]!=1) { ?>
	<a href="<?php echo $baseurl_short?>pages/upload.php?ref=<?php echo urlencode($ref) ?>&search=<?php echo urlencode($search)?>&offset=<?php echo urlencode($offset) ?>&order_by=<?php echo urlencode($order_by) ?>&sort=<?php echo urlencode($sort) ?>&archive=<?php echo urlencode($archive) ?>&upload_a_file=true" onClick="return CentralSpaceLoad(this,true);">&gt;&nbsp;<?php echo $lang["uploadafile"]?></a>
	<?php } else { ?>
	<a href="<?php echo $baseurl_short?>pages/upload_<?php echo $top_nav_upload_type ?>.php?ref=<?php echo urlencode($ref) ?>&search=<?php echo urlencode($search)?>&offset=<?php echo urlencode($offset) ?>&order_by=<?php echo urlencode($order_by) ?>&sort=<?php echo urlencode($sort) ?>&archive=<?php echo urlencode($archive) ?>&replace_resource=<?php echo urlencode($ref)  ?>&resource_type=<?php echo $resource['resource_type']?>" onClick="return CentralSpaceLoad(this,true);">&gt;&nbsp;<?php echo $lang["replacefile"]?></a>
	<?php hook("afterreplacefile"); ?>
	<?php } ?>
	<?php if (! $disable_upload_preview) { ?><br />
	<a href="<?php echo $baseurl_short?>pages/upload_preview.php?ref=<?php echo urlencode($ref) ?>&search=<?php echo urlencode($search)?>&offset=<?php echo urlencode($offset) ?>&order_by=<?php echo urlencode($order_by) ?>&sort=<?php echo urlencode($sort) ?>&archive=<?php echo urlencode($archive) ?>" onClick="return CentralSpaceLoad(this,true);">&gt;&nbsp;<?php echo $lang["uploadpreview"]?></a><?php } ?>
	<?php if (! $disable_alternative_files) { ?><br />
	<a href="<?php echo $baseurl_short?>pages/alternative_files.php?ref=<?php echo urlencode($ref) ?>&search=<?php echo urlencode($search)?>&offset=<?php echo urlencode($offset) ?>&order_by=<?php echo urlencode($order_by) ?>&sort=<?php echo urlencode($sort) ?>&archive=<?php echo urlencode($archive) ?>"  onClick="return CentralSpaceLoad(this,true);">&gt;&nbsp;<?php echo $lang["managealternativefiles"]?></a><?php } ?>
	<?php if ($allow_metadata_revert){?><br />
	<a href="<?php echo $baseurl_short?>pages/edit.php?ref=<?php echo urlencode($ref) ?>&exif=true&search=<?php echo urlencode($search)?>&offset=<?php echo urlencode($offset) ?>&order_by=<?php echo urlencode($order_by) ?>&sort=<?php echo urlencode($sort) ?>&archive=<?php echo urlencode($archive) ?>" onClick="return confirm('<?php echo $lang["confirm-revertmetadata"]?>');">&gt; 
	<?php echo $lang["action-revertmetadata"]?></a><?php } ?>
	<?php hook("afterfileoptions"); ?>
开发者ID:Jtgadbois,项目名称:Pedadida,代码行数:31,代码来源:edit.php


示例7: round

: <b><?php 
    echo round(($avail ? $used / $avail : 0) * 100, 0);
    ?>
%</b> (<?php 
    echo $lang["available"];
    ?>
: <?php 
    echo formatfilesize($avail);
    ?>
; <?php 
    echo $lang["used"];
    ?>
: <?php 
    echo formatfilesize($used);
    ?>
; <?php 
    echo $lang["free"];
    ?>
:  <?php 
    echo formatfilesize($free);
    ?>
)
</p>
<?php 
}
?>

</div>

<?php 
include "../../include/footer.php";
开发者ID:vongalpha,项目名称:resourcespace,代码行数:31,代码来源:team_home.php


示例8: get_resource_access

        }
    }
}
if ($original) {
    for ($i = 0; $i < count($results); $i++) {
        $access = get_resource_access($results[$i]);
        $filepath = get_resource_path($results[$i]['ref'], TRUE, '', FALSE, $results[$i]['file_extension'], -1, 1, FALSE, '', -1);
        $original_link = get_resource_path($results[$i]['ref'], FALSE, '', FALSE, $results[$i]['file_extension'], -1, 1, FALSE, '', -1);
        if (file_exists($filepath)) {
            $results[$i]['original_link'] = $original_link;
        } else {
            $results[$i]['original_link'] = 'No original link available.';
        }
        // Get the size of the original file:
        $original_size = get_original_imagesize($results[$i]['ref'], $filepath, $results[$i]['file_extension']);
        $original_size = formatfilesize($original_size[0]);
        $original_size = str_replace('&nbsp;', ' ', $original_size);
        $results[$i]['original_size'] = $original_size;
    }
}
// flv file and thumb if available
if (getval("flvfile", "") != "") {
    for ($n = 0; $n < count($results); $n++) {
        // flv previews
        $flvfile = get_resource_path($results[$n]['ref'], true, "pre", false, $ffmpeg_preview_extension);
        if (!file_exists($flvfile)) {
            $flvfile = get_resource_path($results[$n]['ref'], true, "", false, $ffmpeg_preview_extension);
        }
        if (!(isset($results[$n]['is_transcoding']) && $results[$n]['is_transcoding'] == 1) && file_exists($flvfile) && strpos(strtolower($flvfile), "." . $ffmpeg_preview_extension) !== false) {
            if (file_exists(get_resource_path($results[$n]['ref'], true, "pre", false, $ffmpeg_preview_extension))) {
                $flashpath = get_resource_path($results[$n]['ref'], false, "pre", false, $ffmpeg_preview_extension, -1, 1, false, "", -1, false);
开发者ID:perryrothjohnson,项目名称:resourcespace,代码行数:31,代码来源:index.php


示例9: define

}
if (!defined('SUB_PAGE')) {
    define('SUB_PAGE', 'Reports &amp; Stats');
}
$vid_dir = get_directory_size(VIDEOS_DIR);
$thumb_dir = get_directory_size(THUMBS_DIR);
$orig_dir = get_directory_size(ORIGINAL_DIR);
$user_thumbs = get_directory_size(USER_THUMBS_DIR);
$user_bg = get_directory_size(USER_BG_DIR);
$grp_thumbs = get_directory_size(GP_THUMB_DIR);
$cat_thumbs = get_directory_size(CAT_THUMB_DIR);
assign('vid_dir', $vid_dir);
assign('thumb_dir', $thumb_dir);
assign('orig_dir', $orig_dir);
assign('user_thumbs', $user_thumbs);
assign('user_bg', $user_bg);
assign('grp_thumbs', $grp_thumbs);
assign('cat_thumbs', $cat_thumbs);
if (!defined('MAIN_PAGE')) {
    define('MAIN_PAGE', 'Stats And Configurations');
}
if (!defined('SUB_PAGE')) {
    if ($_GET['view'] == 'search') {
        define('SUB_PAGE', 'Search Members');
    } else {
        define('SUB_PAGE', 'Reports & Stats');
    }
}
assign('db_size', formatfilesize(get_db_size()));
template_files('reports.html');
display_it();
开发者ID:Coding110,项目名称:cbvideo,代码行数:31,代码来源:reports.php


示例10: preview

			if (file_exists($alt_pre_file))
				{
				# Get web path for preview (pass creation date to help cache refresh)
				$alt_pre=get_resource_path($ref,false,"pre",false,"jpg",-1,1,false,$altfiles[$n]["creation_date"],$altfiles[$n]["ref"]);
				}
			}
		?>
		<tr class="DownloadDBlend" <?php if ($alt_pre!="" && $alternative_file_previews_mouseover) { ?>onMouseOver="orig_preview=jQuery('#previewimage').attr('src');orig_width=jQuery('#previewimage').width();jQuery('#previewimage').attr('src','<?php echo $alt_pre ?>');jQuery('#previewimage').width(orig_width);" onMouseOut="jQuery('#previewimage').attr('src',orig_preview);"<?php } ?>>
		<td>
		<?php if(!hook("renderaltthumb")): ?>
		<?php if ($alt_thm!="") { ?><a href="<?php echo $baseurl_short?>pages/preview.php?ref=<?php echo urlencode($ref)?>&alternative=<?php echo $altfiles[$n]["ref"]?>&k=<?php echo urlencode($k)?>&search=<?php echo urlencode($search)?>&offset=<?php echo urlencode($offset)?>&order_by=<?php echo urlencode($order_by)?>&sort=<?php echo urlencode($sort)?>&archive=<?php echo urlencode($archive)?>&<?php echo hook("previewextraurl") ?>"><img src="<?php echo $alt_thm?>" class="AltThumb"></a><?php } ?>
		<?php endif; ?>
		<h2><?php echo htmlspecialchars($altfiles[$n]["name"])?></h2>
		<p><?php echo htmlspecialchars($altfiles[$n]["description"])?></p>
		</td>
		<td><?php echo formatfilesize($altfiles[$n]["file_size"])?></td>
		
		<?php if ($userrequestmode==2 || $userrequestmode==3) { ?><td></td><?php } # Blank spacer column if displaying a price above (basket mode).
		?>
		
		<?php if ($access==0){?>
		<td class="DownloadButton">
		<?php if (!$direct_download || $save_as){?>
		<a <?php if (!hook("downloadlink","",array("ref=" . $ref . "&alternative=" . $altfiles[$n]["ref"] . "&k=" . $k . "&ext=" . $altfiles[$n]["file_extension"]))) { ?>href="<?php echo $baseurl_short?>pages/terms.php?ref=<?php echo urlencode($ref)?>&k=<?php echo urlencode($k)?>&search=<?php echo urlencode($search) ?>&url=<?php echo urlencode("pages/download_progress.php?ref=" . $ref . "&ext=" . $altfiles[$n]["file_extension"] . "&k=" . $k . "&alternative=" . $altfiles[$n]["ref"] . "&search=" . urlencode($search) . "&offset=" . $offset . "&archive=" . $archive . "&sort=".$sort."&order_by=" . urlencode($order_by))?>"<?php } ?> onClick="return CentralSpaceLoad(this,true);"><?php echo $lang["action-download"] ?></a>
		<?php } else { ?>
			<a href="#" onclick="directDownload('<?php echo $baseurl_short?>pages/download_progress.php?ref=<?php echo urlencode($ref)?>&ext=<?php echo $altfiles[$n]["file_extension"]?>&k=<?php echo urlencode($k)?>&alternative=<?php echo $altfiles[$n]["ref"]?>')"><?php echo $lang["action-download"]?></a>
		<?php } // end if direct_download ?></td></td>
		<?php } else { ?>
		<td class="DownloadButton DownloadDisabled"><?php echo $lang["access1"]?></td>
		<?php } ?>
		</tr>
开发者ID:Jtgadbois,项目名称:Pedadida,代码行数:31,代码来源:view.php


示例11: include

$search=getvalescaped("search","");
$offset=getvalescaped("offset","",true);
$order_by=getvalescaped("order_by","");
$archive=getvalescaped("archive","",true);
$restypes=getvalescaped("restypes","");
$starsearch=getvalescaped("starsearch","");
if (strpos($search,"!")!==false) {$restypes="";}

$default_sort="DESC";
if (substr($order_by,0,5)=="field"){$default_sort="ASC";}
$sort=getval("sort",$default_sort);

$results=do_search(getval("search",""),getvalescaped("restypes",""),"relevance",getval("archive",""),-1,"desc",false,$starsearch,false,true);
$disk_usage=$results[0]["total_disk_usage"];
$count=$results[0]["total_resources"];

include ("../include/header.php");

?>
<p><a onClick="return CentralSpaceLoad(this,true);" href="<?php echo $baseurl_short?>pages/search.php?search=<?php echo urlencode(getval("search","")) ?>&offset=<?php echo urlencode($offset)?>&order_by=<?php echo urlencode($order_by)?>&sort=<?php echo urlencode($sort)?>&archive=<?php echo urlencode($archive)?>&k=<?php echo urlencode($k)?>">&lt; <?php echo $lang["back"] ?></a></p>

<h1><?php echo $lang["searchitemsdiskusage"] ?></h1>
<p><?php echo $lang["matchingresourceslabel"] . ": " . number_format($count)  ?>
<br />
<?php echo $lang["diskusage"] . ": <strong>" . formatfilesize($disk_usage) . "</strong>" ?></p>

<?php


include ("../include/footer.php");
开发者ID:Jtgadbois,项目名称:Pedadida,代码行数:30,代码来源:search_disk_usage.php


示例12: while

				<thead><tr>
				<th scope="col" width="150" style="border-width: 0px 0;color:#636363;font-size: 10pt; font-weight: bold; line-height:normal; text-align: left; border-bottom: 0.2em solid #09f;">Script:</th>
				<th scope="col" width="125" style="border-width: 0px 0;color:#636363;font-size: 10pt; font-weight: bold; line-height:normal; text-align: left; border-bottom: 0.2em solid #09f;">Date:</th>
				<th scope="col" width="100" style="border-width: 0px 0;color:#636363;font-size: 10pt; font-weight: bold; line-height:normal; text-align: left; border-bottom: 0.2em solid #09f;">Start:</th>
				<th scope="col" width="100" style="border-width: 0px 0;color:#636363;font-size: 10pt; font-weight: bold; line-height:normal; text-align: left; border-bottom: 0.2em solid #09f;">End:</th>
				<th scope="col" width="100" style="border-width: 0px 0;color:#636363;font-size: 10pt; font-weight: bold; line-height:normal; text-align: left; border-bottom: 0.2em solid #09f;">YQL Queries:</th>
				<th scope="col" width="100" style="border-width: 0px 0;color:#636363;font-size: 10pt; font-weight: bold; line-height:normal; text-align: left; border-bottom: 0.2em solid #09f;">No Records:</th>
				<th scope="col" width="450" style="border-width: 0px 0;color:#636363;font-size: 10pt; font-weight: bold; line-height:normal; text-align: left; border-bottom: 0.2em solid #09f;">Info:</th>
				</tr>
				</thead>
				<tbody>';
while ($row = mysql_fetch_array($query, MYSQL_ASSOC)) {
    $report .= '<tr>
						<td style="text-align: left; vertical-align: bottom; white-space: nowrap; font: 10pt Verdana, Helvetica; border-spacing: 0; border-collapse: separate; margin: 0 0 0 0; color:#636363;">' . $row['script'] . '</td>
						<td style="text-align: left; vertical-align: bottom; white-space: nowrap; font: 10pt Verdana, Helvetica; border-spacing: 0; border-collapse: separate; margin: 0 0 0 0; color:#636363;">' . $row['date'] . '</td>
						<td style="text-align: left; vertical-align: bottom; white-space: nowrap; font: 10pt Verdana, Helvetica; border-spacing: 0; border-collapse: separate; margin: 0 0 0 0; color:#636363;">' . $row['start'] . '</td>
						<td style="text-align: left; vertical-align: bottom; white-space: nowrap; font: 10pt Verdana, Helvetica; border-spacing: 0; border-collapse: separate; margin: 0 0 0 0; color:#636363;">' . $row['end'] . '</td>
						<td style="text-align: left; vertical-align: bottom; white-space: nowrap; font: 10pt Verdana, Helvetica; border-spacing: 0; border-collapse: separate; margin: 0 0 0 0; color:#636363;">' . $row['yqlqty'] . '</td>
						<td style="text-align: left; vertical-align: bottom; white-space: nowrap; font: 10pt Verdana, Helvetica; border-spacing: 0; border-collapse: separate; margin: 0 0 0 0; color:#636363;">' . $row['records'] . '</td>
						<td style="text-align: left; vertical-align: bottom; white-space: nowrap; font: 10pt Verdana, Helvetica; border-spacing: 0; border-collapse: separate; margin: 0 0 0 0; color:#636363;">' . $row['info'] . '</td>
						</tr>';
}
$report .= '</table><br><font style="text-align: left; vertical-align: bottom; white-space: nowrap; font: 10pt Verdana, Helvetica; border-spacing: 0; border-collapse: separate; margin: 0 0 0 0; color:#636363;">The size of the database is ' . formatfilesize($dbsize) . '</font></td></tr></table><br><br>' . $emailFooter . '</body></html>';
echo $report;
// Sent email with results:
if ($cronMailDailyReport > 0) {
    $subject = 'Daily Database Activity Report';
    $headers = 'From: ' . $fromEmail . '' . "\r\n" . 'Reply-To: [email protected]' . "\r\n" . 'MIME-Version: 1.0' . "\r\n" . 'Content-type: text/html; charset=iso-8859-1' . "\r\n" . 'X-Mailer: PHP/' . phpversion();
    mail($adminEmail, $subject, $report, $headers);
}
mysql_close($conn);
开发者ID:bbulpett,项目名称:MyIchimoku,代码行数:31,代码来源:dailyreport.php


示例13: getvalescaped

<?php

include "../../include/db.php";
include "../../include/general.php";
include "../../include/resource_functions.php";
$uniqid = getvalescaped("id", "");
$progress_file = get_temp_dir(false, $uniqid) . "/progress_file.txt";
if (!file_exists($progress_file)) {
    touch($progress_file);
}
$content = file_get_contents($progress_file);
if ($content == "") {
    echo $lang['preparingzip'];
} else {
    if ($content == "zipping") {
        $files = scandir(get_temp_dir(false, $uniqid));
        foreach ($files as $file) {
            if (strpos($file, "zip.zip") !== false) {
                echo "zipping " . formatfilesize(filesize(get_temp_dir(false, $uniqid) . "/" . $file));
            }
        }
    } else {
        ob_start();
        echo $content;
        ob_flush();
        exit;
    }
}
// echo whatever the script has placed here.
开发者ID:chandradrupal,项目名称:resourcespace,代码行数:29,代码来源:collection_download_progress.php


示例14: getvalescaped

include "../../include/resource_functions.php";
$uniqid = getvalescaped("id", "");
$user = getvalescaped("user", "");
// Need to get this from query string since we haven't authenticated
$usertempdir = get_temp_dir(false, "rs_" . $user . "_" . $uniqid);
$progress_file = $usertempdir . "/progress_file.txt";
//$progress_file=get_temp_dir(false,$uniqid) . "/progress_file.txt";
if (!file_exists($progress_file)) {
    touch($progress_file);
}
$content = file_get_contents($progress_file);
if ($content == "") {
    echo $lang['preparingzip'];
} else {
    if ($content == "zipping") {
        $files = scandir($usertempdir);
        echo "zipping";
        foreach ($files as $file) {
            //echo $file;
            if (strpos($file, ".zip") !== false) {
                echo formatfilesize(filesize($usertempdir . "/" . $file));
            }
        }
    } else {
        ob_start();
        echo $content;
        ob_flush();
        exit;
    }
}
// echo whatever the script has placed here.
开发者ID:perryrothjohnson,项目名称:resourcespace,代码行数:31,代码来源:collection_download_progress.php


示例15: formatfilesize

?>
</h1>
<h2><?php 
echo $titleh2;
?>
</h2>
<div id="plupload_instructions"><p><?php 
echo $intro;
?>
</p></div>
<?php 
if (isset($plupload_max_file_size)) {
    if (is_numeric($plupload_max_file_size)) {
        $sizeText = formatfilesize($plupload_max_file_size);
    } else {
        $sizeText = formatfilesize(filesize2bytes($plupload_max_file_size));
    }
    echo ' ' . sprintf($lang['plupload-maxfilesize'], $sizeText);
}
hook("additionaluploadtext");
if ($allowed_extensions != "") {
    $allowed_extensions = str_replace(", ", ",", $allowed_extensions);
    $list = explode(",", trim($allowed_extensions));
    sort($list);
    $allowed_extensions = implode(",", $list);
    ?>
<p><?php 
    echo str_replace_formatted_placeholder("%extensions", str_replace(",", ", ", $allowed_extensions), $lang['allowedextensions-extensions']);
    ?>
</p><?php 
}
开发者ID:chandradrupal,项目名称:resourcespace,代码行数:31,代码来源:upload_plupload.php


示例16: time

    //Bytes Transfered
    $cur_speed = $now_file_size - $byte_size;
    //Time Eta
    $download_bytes = $total_size - $now_file_size;
    if ($cur_speed > 0) {
        $time_eta = $download_bytes / $cur_speed;
    } else {
        $time_eta = 0;
    }
    //Time Took
    $time_took = time() - $started;
    $curl_info = array('total_size' => $total_size, 'downloaded' => $now_file_size, 'speed_download' => $cur_speed, 'time_eta' => $time_eta, 'time_took' => $time_took, 'file_name' => $file);
    $fo = fopen($log_file, 'w+');
    fwrite($fo, json_encode($curl_info));
    fclose($fo);
    $fo = fopen($dummy_file, 'w+');
    fwrite($fo, json_encode($data));
    fclose($fo);
    if ($total_size == $now_file_size) {
        unlink($dummy_file);
    }
}
if (file_exists($log_file)) {
    $details = file_get_contents($log_file);
    $details = json_decode($details, true);
    $details['total_size_fm'] = formatfilesize($details['total_size']);
    $details['downloaded_fm'] = formatfilesize($details['downloaded']);
    $details['time_eta_fm'] = SetTime($details['time_eta']);
    $details['time_took_fm'] = SetTime($details['time_took']);
    echo json_encode($details);
}
开发者ID:yukisky,项目名称:clipbucket,代码行数:31,代码来源:file_results.php


示例17: get_image_sizes

function get_image_sizes($ref,$internal=false,$extension="jpg",$onlyifexists=true)
	{
	# Returns a table of available image sizes for resource $ref. The standard image sizes are translated using $lang. Custom image sizes are i18n translated.
	# The original image file assumes the name of the 'nearest size (up)' in the table

	global $imagemagick_calculate_sizes;

	# Work out resource type
	$resource_type=sql_value("select resource_type value from resource where ref='$ref'","");

	# add the original image
	$return=array();
	$lastname=sql_value("select name value from preview_size where width=(select max(width) from preview_size)",""); # Start with the highest resolution.
	$lastpreview=0;$lastrestricted=0;
	$path2=get_resource_path($ref,true,'',false,$extension);

	if (file_exists($path2) && !checkperm("T" . $resource_type . "_"))
	{ 
		$returnline=array();
		$returnline["name"]=lang_or_i18n_get_translated($lastname, "imagesize-");
		$returnline["allow_preview"]=$lastpreview;
		$returnline["allow_restricted"]=$lastrestricted;
		$returnline["path"]=$path2;
		$returnline["id"]="";
		$dimensions = sql_query("select width,height,file_size,resolution,unit from resource_dimensions where resource=". $ref);
		
		if (count($dimensions))
			{
			$sw = $dimensions[0]['width']; if ($sw==0) {$sw="?";}
			$sh = $dimensions[0]['height']; if ($sh==0) {$sh="?";}
			$filesize=$dimensions[0]['file_size'];
			# resolution and unit are not necessarily available, set to empty string if so.
			$resolution = ($dimensions[0]['resolution'])?$dimensions[0]['resolution']:"";
			$unit = ($dimensions[0]['unit'])?$dimensions[0]['unit']:"";
			}
		else
			{
			global $imagemagick_path;
			$file=$path2;
			$filesize=filesize_unlimited($file);
			
			# imagemagick_calculate_sizes is normally turned off 
			if (isset($imagemagick_path) && $imagemagick_calculate_sizes)
				{
				# Use ImageMagick to calculate the size
				
				$prefix = '';
				# Camera RAW images need prefix
				if (preg_match('/^(dng|nef|x3f|cr2|crw|mrw|orf|raf|dcr)$/i', $extension, $rawext)) { $prefix = $rawext[0] .':'; }

				# Locate imagemagick.
                $identify_fullpath = get_utility_path("im-identify");
                if ($identify_fullpath==false) {exit("Could not find ImageMagick 'identify' utility at location '$imagemagick_path'.");}	
				# Get image's dimensions.
                $identcommand = $identify_fullpath . ' -format %wx%h '. escapeshellarg($prefix . $file) .'[0]';
				$identoutput=run_command($identcommand);
				preg_match('/^([0-9]+)x([0-9]+)$/ims',$identoutput,$smatches);
				@list(,$sw,$sh) = $smatches;
				if (($sw!='') && ($sh!=''))
				  {
					sql_query("insert into resource_dimensions (resource, width, height, file_size) values('". $ref ."', '". $sw ."', '". $sh ."', '" . $filesize . "')");
					}
				}	
			else 
				{
				# check if this is a raw file.	
				$rawfile = false;
				if (preg_match('/^(dng|nef|x3f|cr2|crw|mrw|orf|raf|dcr)$/i', $extension, $rawext)){$rawfile=true;}
					
				# Use GD to calculate the size
				if (!((@list($sw,$sh) = @getimagesize($file))===false)&& !$rawfile)
				 	{		
					sql_query("insert into resource_dimensions (resource, width, height, file_size) values('". $ref ."', '". $sw ."', '". $sh ."', '" . $filesize . "')");
					}
				else
					{
					# Size cannot be calculated.
					$sw="?";$sh="?";
					
					# Insert a dummy row to prevent recalculation on every view.
					sql_query("insert into resource_dimensions (resource, width, height, file_size) values('". $ref ."','0', '0', '" . $filesize . "')");
					}
				}
			}
		if (!is_numeric($filesize)) {$returnline["filesize"]="?";$returnline["filedown"]="?";}
		else {$returnline["filedown"]=ceil($filesize/50000) . " seconds @ broadband";$returnline["filesize"]=formatfilesize($filesize);}
		$returnline["width"]=$sw;			
		$returnline["height"]=$sh;
		$returnline["extension"]=$extension;
		(isset($resolution))?$returnline["resolution"]=$resolution:$returnline["resolution"]="";
		(isset($unit))?$returnline["unit"]=$unit:$returnline["unit"]="";
		$return[]=$returnline;
	}
	# loop through all image sizes
	$sizes=sql_query("select * from preview_size order by width desc");
	for ($n=0;$n<count($sizes);$n++)
		{
		$path=get_resource_path($ref,true,$sizes[$n]["id"],false,"jpg");

		$resource_type=sql_value("select resource_type value from resource where ref='$ref'","");
//.........这里部分代码省略.........
开发者ID:Jtgadbois,项目名称:Pedadida,代码行数:101,代码来源:general.php


示例18: __

?>
</a></dd>
			<dt><?php 
echo __("Staff:", $module);
?>
</dt>
			<dd><?php 
echo $this->administration->no_active_users();
?>
</dd>
			<dt><?php 
echo __("Database size:", $module);
?>
</dt>
			<dd><?php 
echo formatfilesize($this->administration->db_size());
?>
</dd>
			<dt>C<?php 
echo __("Cache size:", $module);
?>
 <?php 
echo anchor('admin/clear_cache', __("Clear", $module));
?>
</dt>
			<dd><?php 
echo recursive_directory_size($this->config->item('cache_path'), TRUE);
?>
</dd>
		</dl>
	</div>
开发者ID:wildanSawaludin,项目名称:ci-cms,代码行数:31,代码来源:index.php


示例19: elseif

}
$parse_main['{width_preview_elements}'] = '';
$parse_main['{height_preview_elements}'] = '';
if (isset($config['width_preview_elements']) and $config['width_preview_elements'] != '') {
    $parse_main['{width_preview_elements}'] = 'value="' . $config['width_preview_elements'] . '" ';
} elseif (isset($config['height_preview_elements']) and $config['height_preview_elements'] != '') {
    $parse_main['{height_preview_elements}'] = 'value="' . $config['height_preview_elements'] . '" ';
}
if (isset($error) and is_array($error)) {
    $parse_main['{error}'] = parse_template(get_template('info'), array("{type}" => 'error', "{title}" => "Ошибка!", "{text}" => implode("<br />", $error)));
} else {
    $parse_main['{error}'] = '';
}
$cachefile = $config['cachefile'];
if (!file_exists($cachefile) or time() - @filemtime($cachefile) > $config['cache_time']) {
    touch($cachefile);
    //чтобы только один пользователь запускал подсчет
    list($size, $images_total, $images_h24) = get_dir_size($config['uploaddir']);
    $size = formatfilesize($size);
    file_put_contents($cachefile, "{$images_total}|{$size}|{$images_h24}");
} elseif (file_exists($cachefile)) {
    list($images_total, $size, 

鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
PHP formatprice函数代码示例发布时间:2022-05-15
下一篇:
PHP formated_weight函数代码示例发布时间: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