本文整理汇总了PHP中Files::formatSize方法的典型用法代码示例。如果您正苦于以下问题:PHP Files::formatSize方法的具体用法?PHP Files::formatSize怎么用?PHP Files::formatSize使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Files
的用法示例。
在下文中一共展示了Files::formatSize方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: drawFiles
/**
* Draw the files in an table.
*/
function drawFiles($list, &$manager)
{
global $relative;
foreach ($list as $entry => $file) {
?>
<td><table width="100" cellpadding="0" cellspacing="0"><tr><td class="block">
<a href="javascript:;" onclick="selectImage('<?php
echo $file['relative'];
?>
', '<?php
echo $entry;
?>
', <?php
echo $file['image'][0];
?>
, <?php
echo $file['image'][1];
?>
);"title="<?php
echo $entry;
?>
- <?php
echo Files::formatSize($file['stat']['size']);
?>
"><img src="<?php
echo $manager->getThumbnail($file['relative']);
?>
" alt="<?php
echo $entry;
?>
- <?php
echo Files::formatSize($file['stat']['size']);
?>
"/></a>
</td></tr><tr><td class="edit">
<a href="images.php?dir=<?php
echo $relative;
?>
&delf=<?php
echo rawurlencode($file['relative']);
?>
" title="Trash" onclick="return confirmDeleteFile('<?php
echo $entry;
?>
');"><img src="img/edit_trash.gif" height="15" width="15" alt="Trash"/></a><a href="javascript:;" title="Edit" onclick="editImage('<?php
echo rawurlencode($file['relative']);
?>
');"><img src="img/edit_pencil.gif" height="15" width="15" alt="Edit"/></a>
<?php
if ($file['image']) {
echo $file['image'][0] . 'x' . $file['image'][1];
} else {
echo $entry;
}
?>
</td></tr></table></td>
<?php
}
//foreach
}
示例2: drawFiles
/**
* Draw the files in an table.
*/
function drawFiles($list, &$manager)
{
global $relative;
global $IMConfig;
switch ($IMConfig['ViewMode']) {
case 'details':
?>
<script language="Javascript">
<!--
function showPreview(f_url)
{
window.parent.document.getElementById('f_preview').src =
window.parent._backend_url + '__function=thumbs&img=' + f_url;
}
//-->
</script>
<table class="listview">
<thead>
<tr><th>Name</th><th>Filesize</th><th>Dimensions</th></tr></thead>
<tbody>
<?php
foreach ($list as $entry => $file) {
?>
<tr>
<th><a href="#" class="thumb" style="cursor: pointer;" onclick="selectImage('<?php
echo $file['relative'];
?>
', '<?php
echo $entry;
?>
', <?php
echo $file['image'][0];
?>
, <?php
echo $file['image'][1];
?>
);return false;" title="<?php
echo $entry;
?>
- <?php
echo Files::formatSize($file['stat']['size']);
?>
" onmouseover="showPreview('<?php
echo $file['relative'];
?>
')" onmouseout="showPreview(window.parent.document.getElementById('f_url').value)" ><?php
echo $entry;
?>
</a></th>
<td><?php
echo Files::formatSize($file['stat']['size']);
?>
</td>
<td><?php
if ($file['image']) {
echo $file['image'][0] . 'x' . $file['image'][1];
}
?>
<td class="actions">
<a href="<?php
print $IMConfig['backend_url'];
?>
__function=images&dir=<?php
echo $relative;
?>
&delf=<?php
echo rawurlencode($file['relative']);
?>
" title="Trash" onclick="return confirmDeleteFile('<?php
echo $entry;
?>
');"><img src="<?php
print $IMConfig['base_url'];
?>
img/edit_trash.gif" height="15" width="15" alt="Trash" border="0" /></a>
<a href="javascript:;" title="Edit" onclick="editImage('<?php
echo rawurlencode($file['relative']);
?>
');"><img src="<?php
print $IMConfig['base_url'];
?>
img/edit_pencil.gif" height="15" width="15" alt="Edit" border="0" /></a>
</td>
</tr>
<?php
}
?>
</tbody>
</table>
<?php
break;
case 'thumbs':
default:
foreach ($list as $entry => $file) {
?>
//.........这里部分代码省略.........
示例3: drawDirs_Files
//.........这里部分代码省略.........
<?php
}
// end of foreach for draw listview folders .
clearstatcache();
// start of foreach for draw listview files .
foreach ($list[1] as $entry => $file) {
?>
<tr>
<td><img src="<?php
print $IMConfig['base_url'];
if (is_file('icons/' . $file['ext'] . '_small.gif')) {
echo "icons/" . $file['ext'] . "_small.gif";
} else {
echo $IMConfig['default_listicon'];
}
?>
" alt="" /></td>
<th><a href="#" class="thumb" style="cursor: pointer;" onclick="selectImage('<?php
echo $file['relative'];
?>
', '<?php
echo preg_replace('#\\..{3,4}$#', '', $entry);
?>
', <?php
echo $file['image'][0];
?>
, <?php
echo $file['image'][1];
?>
);return false;" title="<?php
echo $entry;
?>
- <?php
echo Files::formatSize($file['stat']['size']);
?>
" <?php
if ($insertMode == 'image') {
?>
onmouseover="showPreview('<?php
echo $file['relative'];
?>
')" onmouseout="showPreview(window.parent.document.getElementById('f_url').value)" <?php
}
?>
>
<?php
if (strlen($entry) > $maxNameLength) {
echo substr($entry, 0, $maxNameLength) . "...";
} else {
echo $entry;
}
?>
</a></th>
<td><?php
echo Files::formatSize($file['stat']['size']);
?>
</td>
<td><?php
if ($file['image'][0] > 0) {
echo $file['image'][0] . 'x' . $file['image'][1];
}
?>
</td>
<td nowrap><?php
echo date("d.m.y H:i", $file['stat']['mtime']);
?>
示例4: drawFiles
/**
* Draw the files in an table.
*/
function drawFiles($list, &$manager, $i)
{
global $relative;
$image_per_line = 5;
foreach ($list as $entry => $file) {
$i++;
if ($i == 1) {
echo "<tr>";
}
?>
<td><table width="100" cellpadding="0" cellspacing="0"><tr><td class="block">
<a href="<?php
echo "{$manager->config['base_url']}{$file['relative']}";
?>
" target="_blank" title="<?php
echo $entry;
?>
- <?php
echo Files::formatSize($file['stat']['size']);
?>
"><img src="<?php
if (function_exists('imagecreate')) {
echo $manager->getThumbnail($file['relative']);
} else {
if ($file['image']) {
$size_x = $file['image'][0];
$size_y = $file['image'][1];
}
if ($size_x < 96 && $size_y < 96) {
} elseif ($size_x > $size_y) {
$size_y = round($size_y / ($size_x / 96));
$size_x = 96;
} else {
$size_x = round($size_x / ($size_y / 96));
$size_y = 96;
}
echo "{$manager->config['base_url']}{$file['relative']}";
echo "\" width=\"{$size_x}\" height=\"{$size_y}";
}
?>
" alt="<?php
echo $entry;
?>
- <?php
echo Files::formatSize($file['stat']['size']);
?>
"/></a>
</td></tr><tr><td class="edit">
<a href="images.php?dir=<?php
echo $relative;
?>
&delf=<?php
echo rawurlencode($file['relative']);
?>
" title="Trash" onclick="return confirmDeleteFile('<?php
echo $entry;
?>
');"><img src="img/edit_trash.gif" height="15" width="15" alt="Trash"/></a><a href="javascript:;" title="Edit" onclick="editImage('<?php
echo rawurlencode($file['relative']);
?>
');"><img src="img/edit_pencil.gif" height="15" width="15" alt="Edit"/></a>
<?php
if ($file['image']) {
echo $file['image'][0] . 'x' . $file['image'][1];
} else {
echo $entry;
}
?>
</td></tr></table></td>
<?php
if ($i == $image_per_line) {
echo "</tr>";
$i = 0;
}
}
//foreach
return $i;
}
示例5: getDiskInfo
function getDiskInfo()
{
if (empty($this->config['max_foldersize_mb'])) {
return '';
}
$tmpFreeSize = $this->config['max_foldersize_mb'] * 1048576 - Files::dirSize($this->getImagesDir());
if (!is_numeric($tmpFreeSize) || $tmpFreeSize < 0) {
$tmpFreeSize = 0;
}
return 'Total Size : $max_foldersize_mb=' . $this->config['max_foldersize_mb'] . '$ MB, Free Space: $free_space=' . Files::formatSize($tmpFreeSize) . '$';
}
示例6: drawFiles
/**
* Draw the files in an table.
*/
function drawFiles($list, &$manager)
{
global $relative;
global $IMConfig;
// add filename with course code in it
// here filename is images/gallery/COMES.jpg
// it should be /chamilo1884url/courses/COURSTESTSIMSUURLAPP/document/
global $_configuration;
//var topDoc = window.top.document;
$course_id = api_get_course_id();
$in_course = $course_id != -1 ? true : false;
foreach ($list as $entry => $file) {
//$chamiloPath = '/'.$_configuration['url_append'].'/courses/'.api_get_course_path().'/document'.$file['relative'];
?>
<td><table width="100" cellpadding="0" cellspacing="0"><tr><td class="block">
<!-- change <?php
echo $file['relative'];
?>
with <?php
echo $chamiloPath;
?>
<a href="javascript: void(0);" onclick="selectImage('<?php
echo $file['relative'];
?>
', '<?php
echo $entry;
?>
', <?php
echo $file['image'][0];
?>
, <?php
echo $file['image'][1];
?>
);"title="<?php
echo $entry;
?>
- <?php
echo Files::formatSize($file['stat']['size']);
?>
"><img src="<?php
echo $manager->getThumbnail($file['relative']);
?>
" alt="<?php
echo $entry;
?>
- <?php
echo Files::formatSize($file['stat']['size']);
?>
"/></a>
-->
<a href="javascript: void(0);" onclick="selectImage('<?php
echo $file['relative'];
?>
', '<?php
echo $entry;
?>
', <?php
echo $file['image'][0];
?>
, <?php
echo $file['image'][1];
?>
);"title="<?php
echo $entry;
?>
- <?php
echo Files::formatSize($file['stat']['size']);
?>
"><img src="<?php
echo $manager->getThumbnail($file['relative']);
?>
" alt="<?php
echo $entry;
?>
- <?php
echo Files::formatSize($file['stat']['size']);
?>
"/></a>
</td></tr><tr><td class="edit" style="padding-top: 5px;">
<?php
if ($IMConfig['allow_delete']) {
?>
<a href="images.php?dir=<?php
echo $relative;
?>
&delf=<?php
echo rawurlencode($file['relative']);
?>
" title="Trash" onclick="return confirmDeleteFile('<?php
echo $entry;
?>
');"><img src="img/edit_trash.gif" height="15" width="15" alt="Trash"/></a>
<?php
}
?>
<?php
if ($IMConfig['allow_edit']) {
//.........这里部分代码省略.........