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

PHP formatSizeUnits函数代码示例

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

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



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

示例1: itemProps

 public function itemProps($itemId)
 {
     $itemId = trim($itemId, '/\\');
     if ($this->fs->allow($itemId, $real)) {
         return array_merge(parent::itemProps($itemId), array('inode' => $this->hasChildren($real, $icon), 'icon' => $icon, 'size' => is_file($real) ? formatSizeUnits(filesize($real)) : '', 'type' => recongnizeType($real), 'random' => mt_rand(0, 99)));
     }
     return parent::itemProps($itemId);
 }
开发者ID:vpagliari,项目名称:vpagliari.github.io,代码行数:8,代码来源:FsTree.php


示例2: detail

 function detail()
 {
     $id = $_GET['id'];
     $where = "id = '" . $id . "' AND n_status = '1'";
     $data = $this->models->getData(TRUE, '*', 'floraINA_digirepo', $where);
     //pr($data);
     if ($data) {
         foreach ($data as $key => $value) {
             $data[$key]['content'] = html_entity_decode($value['content'], ENT_QUOTES, 'UTF-8');
             $data[$key]['filesize'] = formatSizeUnits($value['filesize']);
         }
         $this->view->assign('data', $data);
     }
     return $this->loadView('digirepo/reference_detail');
 }
开发者ID:Gunadarma-Codecamp,项目名称:peer-portal,代码行数:15,代码来源:publication.php


示例3: t

?>
		</div>
		<div id="content2">
		 <h1><?php 
echo t('menu.main.agb');
?>
</h1>
			<p><?php 
echo t('page.agb.line1');
?>
</p>
			<p><a href="<?php 
echo $agb_pdf_filepath;
?>
" target="_blank"><?php 
echo substr($agb_pdf_filename, 7) . ' (' . formatSizeUnits(filesize($agb_pdf_filepath), 1) . ')';
?>
</a></p>
		</div>
	<div id="nebennavigation"><div id="nebennavigationinnen"><?php 
include 'inc/nebennavigation.php';
?>
</div>   </div></div>
</div>


</body>
</html>
<?php 
$thread_id = mysqli_thread_id($link);
mysqli_kill($link, $thread_id);
开发者ID:Andreas-Schoenefeldt,项目名称:viszerale-therapie.at,代码行数:31,代码来源:agb.php


示例4: get_userdata

    ?>
?id=<?php 
    echo $post->post_author;
    ?>
">
												<?php 
    $wp = get_userdata($post->post_author);
    echo $wp->display_name;
    ?>
												</a>
											</div>
										</td>
										<td class="filesizetotal">
											<?php 
    $meta = get_post_meta($post->ID, '_wp_collaboration_file_size', true);
    echo formatSizeUnits($meta);
    ?>
										</td>
										<td class="fileslistoptions">
                                        <div class="wrlistitemactionsholder">
											<div class="fileslistoptionstxt wrlistitemactionstxt">
														Options
                                            </div>
											<ul class="fileslistoptionsitems writemactionslist">
												<li class="first"><a href="javascript:void(0);" data-file-id='<?php 
    echo $post->ID;
    ?>
' data-file-name="<?php 
    echo $post->post_title;
    ?>
" onClick="JavaScript:Edd.collaboration.FILES.DOWNLOAD_FILES(this);">Download File</a></li>
开发者ID:alexsharma68,项目名称:EddCollaborationPlugin,代码行数:31,代码来源:frontend-collaboration-file.php


示例5: getEXT

					<div class="box-notice iconFile <?php 
echo $iconType;
?>
">
						<div class="box-text">
							<p class="text-title"><? echo $row['CONTENT_DESC'] ?></p>
							<p class="text-detail">
								<span><?php 
echo $typeCap;
?>
: <? echo getEXT($IMG_PATH) ?></span>
								<span><?php 
echo $sizeCap;
?>
: <?php 
echo formatSizeUnits(filesize($IMG_PATH));
?>
</span>
							</p>
						</div>
						<div class="box-btn cf">
							<a href="<?php 
echo $IMG_PATH;
?>
" target="_blank" class="btn red"><?php 
echo $downloadCap;
?>
</a>
						</div>
					</div>
开发者ID:noppolgap,项目名称:museumsiam,代码行数:30,代码来源:news-event-notice-all.php


示例6: uploadAjax

 function uploadAjax()
 {
     global $basedomain;
     $output_dir = $basedomain . "public_assets/tmp/";
     if (isset($_FILES["myfile"])) {
         $ret = array();
         //  This is for custom errors;
         /*  $custom_error= array();
                 $custom_error['jquery-upload-file-error']="File already exists";
                 echo json_encode($custom_error);
                 die();
             */
         $error = $_FILES["myfile"]["error"];
         //You need to handle  both cases
         //If Any browser does not support serializing of multiple files using FormData()
         if (!is_array($_FILES["myfile"]["name"])) {
             $upload = uploadFile('myfile', 'tmp');
             $ret[0] = $upload['full_name'];
             $ret[1] = $upload['real_name'];
             $ret[2] = formatSizeUnits($_FILES["myfile"]["size"]);
         } else {
             $fileCount = count($_FILES["myfile"]["name"]);
             for ($i = 0; $i < $fileCount; $i++) {
                 $upload = uploadFile('myfile', 'tmp');
                 $ret[0] = $upload['full_name'];
                 $ret[1] = $upload['real_name'];
                 $ret[2] = formatSizeUnits($_FILES["myfile"]["size"]);
             }
         }
         echo json_encode($ret);
         exit;
     }
 }
开发者ID:TrinataBhayanaka,项目名称:sipmas.bsn,代码行数:33,代码来源:pengaduan.php


示例7: filesize

<?php

$path = "../admin_digilib/files/";
$filesize = filesize($path);
$filesizex = formatSizeUnits($filesize);
include "../admin_digilib/config/koneksi.php";
error_reporting(E_ALL ^ E_NOTICE);
session_start();
$member_id = $_SESSION['member_id'];
if (empty($_SESSION['member_id'])) {
    header('location:../login_member.php');
}
$result = mysql_query("SELECT * from digilib_ebook");
function formatSizeUnits($bytes)
{
    if ($bytes >= 1073741824) {
        $bytes = number_format($bytes / 1073741824, 2) . ' GB';
    } elseif ($bytes >= 1048576) {
        $bytes = number_format($bytes / 1048576, 2) . ' MB';
    } elseif ($bytes >= 1024) {
        $bytes = number_format($bytes / 1024, 2) . ' KB';
    } elseif ($bytes > 1) {
        $bytes = $bytes . ' B';
    } elseif ($bytes == 1) {
        $bytes = $bytes . ' B';
    } else {
        $bytes = '0 B';
    }
    return $bytes;
}
?>
开发者ID:BayuAnggoroSakti,项目名称:digital_library,代码行数:31,代码来源:download.php


示例8: foreach

                            
                            <?php 
foreach ($files as $one) {
    ?>
                            <tr>
                                <td><i class="fa <?php 
    echo font_awesome_file_icon_class($one->myme_type);
    ?>
"></i></td>
                                <td><strong><?php 
    echo $one->name;
    ?>
</strong></td>
                                <td>Файл</td>
                                <td><?php 
    echo formatSizeUnits($one->size);
    ?>
</td>
                                <td><?php 
    echo date('d.m.Y', strtotime($one->create_date));
    ?>
</td>
                                <td>
                                    <a href="#"><i class="fa fa-eye"></i></a>
                                    <a href="#"><i class="fa fa-link"></i></a>
                                    <a href="#"><i class="fa fa-trash"></i></a>

                                </td>
                            </tr>
                            <?php 
}
开发者ID:belimovlab,项目名称:intevo,代码行数:30,代码来源:folder.php


示例9: basename

    <div class="col-sm-4">
      <div class="ih-item square effect3 bottom_to_top" style="background-color: #bdc3c7;"><a>
          <div class="img"><img src="<?php 
    echo $file;
    ?>
" alt="<?php 
    echo $file;
    ?>
"></div>
          <div class="info">
            <h3><?php 
    echo basename($file);
    ?>
</h3>
            <p>Taille : <?php 
    echo formatSizeUnits(filesize($file));
    ?>
              <button type="submit" class="btn btn-danger btn-modal" value="<?php 
    echo basename($file);
    ?>
" data-toggle="modal" data-target="#deleteModal">
                <span class="glyphicon glyphicon-trash" aria-hidden="true"></span>
              </button></p>
          </div></a></div>
    </div>
<?php 
}
?>
</div>

开发者ID:Digital-Design,项目名称:Maison-Vacances,代码行数:29,代码来源:media.php


示例10: the_content

    the_content();
    ?>
                        </div>
                        <?php 
    if ($meta[attached_file][0] != '') {
        ?>
                            <div class="doc_cont">
                                <?php 
        $filename = $meta[attached_file][0];
        $explode = explode('/', $meta[attached_file][0]);
        $cv_format = end($explode);
        $explode_dot = explode('.', $cv_format);
        $extention = end($explode_dot);
        $headers = get_headers($filename, 1);
        $fsize = $headers['Content-Length'];
        $mbytes = formatSizeUnits($fsize);
        ?>
                                <?php 
        if ($extention == 'docx' or $extention == 'doc') {
            ?>
                                    <img src="<?php 
            echo get_bloginfo('url') . '/wp-content/themes/cafemocha/custom-images/word_icon.png';
            ?>
" />
                                <?php 
        } else {
            if ($extention == 'pdf') {
                ?>
                                    <img src="<?php 
                echo get_bloginfo('url') . '/wp-content/themes/cafemocha/custom-images/file_pdf.png';
                ?>
开发者ID:CafeMochaOrg,项目名称:SourceCode,代码行数:31,代码来源:single.php


示例11: while

    $hasil = $koneksi_db->sql_query("SELECT * FROM tugassiswa where tugas='{$idtugas}' order by id desc");
    $admin .= '<div class="panel-heading"><b>Data Tugas</b></div>';
    $admin .= '<table id="example" class="table table-striped table-hover">
<thead><tr>
<th width="20px">No</th>
<th>Nama</th>
<th>Kelas</th>
<th>Aksi</th>
</tr></thead><tbody>';
    $no = 1;
    while ($data = $koneksi_db->sql_fetchrow($hasil)) {
        $nama = $data['nama'];
        $kelas = $data['kelas'];
        $file = $data['file'];
        $ukuranfile = filesize('mod/tugas/download/' . $file . '');
        $ukuranfile = formatSizeUnits($ukuranfile);
        $detailbutton = '<a href="?pilih=tugas&amp;mod=yes&amp;aksi=detail&amp;id=' . $data['id'] . '"><span class="btn btn-success">Detail</span></a>';
        $admin .= '<tr>
<td><b>' . $no . '</b></td>
<td>' . $nama . '</td>
<td>' . $kelas . '</td>
<td>' . $detailbutton . '</td>
</tr>';
        $no++;
    }
    $admin .= '</tbody></table>';
}
if ($_GET['aksi'] == "detail") {
    $admin .= '<div class="panel-heading"><b>Data Tugas</b></div>';
    $id = int_filter($_GET['id']);
    $query = mysql_query("SELECT * FROM `tugassiswa` WHERE `id`='{$id}'");
开发者ID:rekysda,项目名称:elearningfratz,代码行数:31,代码来源:siswa_tugas.php


示例12: get_workroom_space_details

function get_workroom_space_details($Workroom_Id)
{
    $total_files = get_files($Workroom_Id);
    $size = 0;
    foreach ($total_files as $file) {
        $size = $size + get_post_meta($file->ID, '_wp_collaboration_file_size', true);
    }
    $available_size = (int) get_option('allowed_space_in_gb');
    $available_size_in_kb = $available_size * 1000000000;
    $free_space = $available_size_in_kb - ($available_size_in_kb - $size);
    $dp = sprintf('%.2f', $free_space / $available_size_in_kb * 100);
    return array('UsedSpace' => $size, 'UsedSpaceWithUnit' => formatSizeUnits($size), 'UsedSpaceWithPercentage' => $dp, 'TotalSpace' => formatSizeUnits($available_size_in_kb));
}
开发者ID:alexsharma68,项目名称:EddCollaborationPlugin,代码行数:13,代码来源:collaboration-functions.php


示例13: number_format

     if ($bytes >= 1073741824) {
         $bytes = number_format($bytes / 1073741824, 2) . ' GB';
     } elseif ($bytes >= 1048576) {
         $bytes = number_format($bytes / 1048576, 2) . ' MB';
     } elseif ($bytes >= 1024) {
         $bytes = number_format($bytes / 1024, 2) . ' KB';
     } elseif ($bytes > 1) {
         $bytes = round($bytes / 1024, 3) . ' KB';
     } elseif ($bytes == 1) {
         $bytes = $bytes . ' byte';
     } else {
         $bytes = '0 bytes';
     }
     return $bytes;
 }
 echo "Bestandsgrootte: " . formatSizeUnits(filesize($dir . "\\" . $bestandsnaam)) . "<br />";
 //Laatste bewerkt:
 $tijd = date("d F Y - H:i:s", filemtime($map . "\\" . $bestandsnaam));
 echo "Laatst aangepast: " . $tijd . "<br />";
 //Images uit de map
 if ($bestandext == "gif") {
     echo '<img src="' . $bestandsnaam . '">';
 }
 // Bestanden aangeven
 if ($bestandext == "jpg" || $bestandext == "png" || $bestandext == "jpeg") {
     $afbeelding = $dir . $bestandsnaam;
     $afbeelding = str_replace(getcwd(), "", $afbeelding);
     $afbeelding = ltrim($afbeelding, '\\');
     echo '<img src="' . $afbeelding . '">';
 }
 if ($bestandext == "php" || $bestandext == "txt" || $bestandext == "css") {
开发者ID:MisterN95,项目名称:PHP-Eindopdracht,代码行数:31,代码来源:index.php


示例14: parse_js_array

if (preg_match('/monthly_history = (.*?);/mis', $output, $matches, PREG_OFFSET_CAPTURE)) {
    $monthly_results = parse_js_array($matches[1][0]);
}
// close curl resource to free up system resources
curl_close($ch);
echo "\${color #B8FF00}Monthly Bandwidth Usage\${color white}\n";
foreach (array_reverse($monthly_results) as $k => $result) {
    if ($k >= 3) {
        break;
    }
    if ($k == 0) {
        echo '${font Bitstream Vera:size=10:style=Bold}';
    } else {
        echo '${font Bitstream Vera:size=10}';
    }
    $date = date("F", strtotime($result[0] . "+ 1 day"));
    echo sprintf("%-25s \${alignr}%-12s \${alignr}%s\n", $date, formatSizeUnits($result[1]), formatSizeUnits($result[2]));
}
echo "\n\${color #B8FF00}Daily Bandwidth Usage\${color white}\n";
foreach (array_reverse($daily_results) as $k => $result) {
    if ($k >= 3) {
        break;
    }
    if ($k == 0) {
        echo '${font Bitstream Vera:size=10:style=Bold}';
    } else {
        echo '${font Bitstream Vera:size=10}';
    }
    $date = date("F jS", strtotime($result[0]));
    echo sprintf("%-25s \${alignr}%-12s \${alignr}%s\n", $date, formatSizeUnits($result[1]), formatSizeUnits($result[2]));
}
开发者ID:bpopp,项目名称:conky-tomato-bwstats,代码行数:31,代码来源:router.php


示例15: while

            <?php 
if (have_posts()) {
    while (have_posts()) {
        the_post();
        the_content();
    }
}
?>
            <div class="clearfix"></div>

            <?php 
$research_pdf = get_post_meta($post->ID, 'authors_section_pdf', true);
$pdf_id = get_pdf_id($research_pdf);
$file_path = filesize(get_attached_file($pdf_id));
$pdf_size = $file_path;
if (!empty($research_pdf)) {
    echo '<a class="button float-right bottom-spacing" target="_blank" href="' . $research_pdf . '">View (PDF, ' . formatSizeUnits($pdf_size) . ')</a>';
}
?>

        </div>
        <!--  Research ends here-->
    </div>
    <?php 
//sidebar comes here
get_sidebar();
?>
  </div>
</div>
<?php 
get_footer();
开发者ID:nationalarchives,项目名称:tna-child-about-us-research,代码行数:31,代码来源:research-repository-details.php


示例16: while

		<td><input type="text" name="judul" value="' . $data['tglakhir'] . '" size="25"class="form-control" disabled></td>
	</tr>
</table>
	';
    $hasil = $koneksi_db->sql_query("SELECT * FROM tugassiswa where tugas='{$idtugas}' order by id desc");
    $admin .= '<div class="panel-heading"><b>Data Tugas</b></div>';
    $admin .= '<table id="example" class="table table-striped table-hover">
<thead><tr>
<th width="20px">No</th>
<th>Nama</th>
<th>Kelas</th>
<th>File</th>
</tr></thead><tbody>';
    $no = 1;
    while ($data = $koneksi_db->sql_fetchrow($hasil)) {
        $nama = $data['nama'];
        $kelas = $data['kelas'];
        $file = $data['file'];
        $ukuranfile = filesize('mod/tugas/download/' . $file . '');
        $admin .= '<tr>
<td><b>' . $no . '</b></td>
<td>' . $nama . '</td>
<td>' . $kelas . '</td>
<td>' . $file . ' (' . formatSizeUnits($ukuranfile) . ')</td>
</tr>';
        $no++;
    }
    $admin .= '</tbody></table>';
}
$admin .= '</div>';
echo $admin;
开发者ID:rekysda,项目名称:elearningfratz,代码行数:31,代码来源:tugas.php


示例17: urlencode

				</td>
				<td width="10%">
					<a href="" class="transparent change-folder" title="Change Name" rel="' . $c['name'] . '"><i class="icon-pencil"></i></a>&nbsp;&nbsp;
					<a href="" class="transparent delete-folder" rel="' . urlencode($c['path']) . '" title="Delete"><i class="icon-trash"></i></a>
				</td>
				</tr>';
            } else {
                $html .= '<tr>
				<td>
				<i class="icon-picture"></i>&nbsp;
				<a href="" class="img-thumbs" rel="' . $c['path'] . '" title="' . $c['name'] . '">
					' . TrimText($c['name'], 50) . '
				</a>
				</td>
				<td width="20%">
				' . formatSizeUnits($c['s']) . '
				</td>
				<td width="10%">
					<a href="" class="transparent change-file" title="Change Name" rel="' . $c['name'] . '"><i class="icon-pencil"></i></a>&nbsp;&nbsp;
					<a href="" class="transparent delete-file" rel="' . urlencode($c['p']) . '" title="Delete"><i class="icon-trash"></i></a>
				</td>
				</tr>';
            }
        } else {
            if ($c['is_file'] == false) {
                $html .= '<div class="item">
			<a class="lib-folder" href="" rel="' . urlencode($c['path']) . '" title="' . $c['name'] . '">
			<img src="bootstrap/img/130x90.png" class="img-polaroid" width="130" height="90">
			</a>
			<div>
			<a href="" class="pull-left transparent change-folder" title="Change Name" rel="' . $c['name'] . '"><i class="icon-pencil"></i></a>
开发者ID:ram-izaap,项目名称:got-safety,代码行数:31,代码来源:contents.php


示例18: fmenu

    function fmenu($if)
    {
        $acc = new Account();
        $acc->getByID($if->file_author);
        $path = _SPPATH . $if->upload_url;
        $fil = $if->file_filename;
        ?>
		<div class="col-md-4">
			<h3 class="h3pv"
			    style="width: 100%; overflow: hidden;"><?php 
        echo $if->file_url;
        ?>
</h3>

			<div class="metadata"><?php 
        echo Lang::t('Author');
        ?>
 : <?php 
        echo $acc->admin_nama_depan;
        ?>
 </div>
			<div class="metadata"><?php 
        echo Lang::t('Size');
        ?>
 : <?php 
        echo formatSizeUnits($if->file_size);
        ?>
 </div>
			<div class="metadata"><?php 
        echo Lang::t('Date');
        ?>
 : <?php 
        echo indonesian_date($if->file_date);
        ?>
 </div>
			<?php 
        $inp = new \Leap\View\InputFile();
        if (in_array($if->file_ext, $inp->arrVideoExt)) {
            ?>
				<!--				<div class="metadata">Embed Code : <br/>--><?php 
            //= '#tbs_video#' . _BPATH . $if->upload_url . $if->file_filename .
            //					'#/tbs_video#'
            ?>
<!--</div>-->
				<div class="clone-url open"
				     data-protocol-type="subversion"
				     data-url="/users/set_protocol?protocol_selector=subversion&amp;protocol_type=clone">
					Embed Code :

					<div class="input-group js-zeroclipboard-container">
						<input type="text"
						       class="input-mini input-monospace js-url-field js-zeroclipboard-target"
						       value="<?php 
            echo '#tbs_video#' . _BPATH . $if->upload_url . $if->file_filename . '#/tbs_video#';
            ?>
"
						       readonly="readonly" />
					</div>
				</div>
			<?php 
        }
        ?>
			<?php 
        if ($if->file_ext == "pdf") {
            ?>
				<?php 
            /*<button style="margin-top: 10px;"
              onclick="window.open('<?= _SPPATH; ?>js/ViewerJS/leappdf.php?nn=<?= $if->file_url; ?>&dd=<?= $if->bolehsave; ?>#<?= base64_encode($path .
               $if->file_filename); ?>.pdf','_blank');"
              class="btn btn-primary"><?= Lang::t('Open'); ?></button>*/
            ?>
			<?php 
        } else {
            ?>
				<button style="margin-top: 10px;"
				        onclick="window.open('<?php 
            echo $path . $fil;
            ?>
','_blank');"
				        class="btn btn-primary"><?php 
            echo Lang::t('Open');
            ?>
</button>
			<?php 
        }
        //pr($if);
        ?>
		</div>
	<?php 
    }
开发者ID:CapsuleCorpIndonesia,项目名称:elang-combo,代码行数:90,代码来源:InputFileWeb.php


示例19: logAvgMemoryUsage

 /**
  * Log the current average memory usage per completed request
  *
  * @return string
  */
 private function logAvgMemoryUsage()
 {
     return formatSizeUnits($this->logMemoryUsage() / $this->countCompleted());
 }
开发者ID:braseidon,项目名称:mole,代码行数:9,代码来源:Crawler.php


示例20: crear

function crear()
{
    set_time_limit(0);
    $ruta = "musica";
    $GLOBALS['contador'] = 1;
    //Empesamos la estructura del archivo xml
    $xml = new DomDocument('1.0');
    $playlist = $xml->createElement('albumList');
    $playlist = $xml->appendChild($playlist);
    // comprobamos si lo que nos pasan es un direcotrio
    if (is_dir($ruta)) {
        // Abrimos el directorio y comprobamos que
        if ($aux = opendir($ruta)) {
            while (($archivo = readdir($aux)) !== false) {
                // Si quisieramos mostrar todo el contenido del directorio pondríamos lo siguiente:
                // echo '<br />' . $file . '<br />';
                // Pero como lo que queremos es mostrar todos los archivos excepto "." y ".."
                if ($archivo != "." && $archivo != "..") {
                    $ruta_completa = $ruta . '/' . $archivo;
                    //echo "Esto: ".$ruta_completa."<br>";
                    if (is_dir($ruta_completa)) {
                        // Abrimos la nueva carpeta, esta sera el nombre del album
                        if ($aux2 = opendir($ruta_completa)) {
                            //echo "Folder: ".$archivo."<br>";
                            //Aui se empiezan a crear los albums
                            $libro = $xml->createElement('album');
                            //se empieza a iterar desde el album
                            $libro = $playlist->appendChild($libro);
                            $autor = $xml->createElement('albumID', "{$GLOBALS['contador']}");
                            $autor = $libro->appendChild($autor);
                            $titulo = $xml->createElement('albumTitle', htmlspecialchars(utf8_encode($archivo)));
                            $titulo = $libro->appendChild($titulo);
                            $anio = $xml->createElement('albumArtist', 'unknown');
                            $anio = $libro->appendChild($anio);
                            //$albumFolder = $xml->createElement('albumFolder','../data/ACDC/Back In Black/');//No se aun que es esto,parece ser la ubicacion de las imagenes
                            $albumFolder = $xml->createElement('albumFolder', '/images');
                            $albumFolder = $libro->appendChild($albumFolder);
                            $albumTracks = $xml->createElement('albumTracks');
                            //Empieza la lista de canciones
                            $albumTracks = $libro->appendChild($albumTracks);
                            $no_cancion = 1;
                            while (($archivo2 = readdir($aux2)) !== false) {
                                if ($archivo2 != "." && $archivo != "..") {
                                    $ruta_completa2 = $ruta_completa . '/' . $archivo2;
                                    if (is_dir($ruta_completa2)) {
                                    } else {
                                        if (substr("{$ruta_completa2}", -3, 3) == "mp3") {
                                            //El sistema solo soporta archivos con expencion mp3
                                            $track = $xml->createElement('track');
                                            $track = $albumTracks->appendChild($track);
                                            $trackID = $xml->createElement('trackID', "{$no_cancion}");
                                            $trackID = $track->appendChild($trackID);
                                            $trackFile = $xml->createElement('trackFile', htmlspecialchars(utf8_encode($ruta_completa2)));
                                            //Ubicacion del archivo
                                            $trackFile = $track->appendChild($trackFile);
                                            $trackTitle = $xml->createElement('trackTitle', htmlspecialchars(utf8_encode($archivo2)));
                                            //Nombre del archivo
                                            $trackTitle = $track->appendChild($trackTitle);
                                            $trackArtist = $xml->createElement('trackArtist', "Unknow");
                                            $trackArtist = $track->appendChild($trackArtist);
                                            //Calcular el timpo de la cancion
                                            $mp3file = new MP3File(htmlspecialchars($ruta_completa2));
                                            $duration2 = $mp3file->getDuration();
                                            //(slower) for VBR (or CBR)
                                            $trackLengh = $xml->createElement('trackLengh', MP3File::formatTime($duration2));
                                            $trackLengh = $track->appendChild($trackLengh);
                                            $trackFileSize = $xml->createElement('trackFileSize', formatSizeUnits(filesize(htmlspecialchars($ruta_completa2))));
                                            //Tamaño del archivo
                                            $trackFileSize = $track->appendChild($trackFileSize);
                                            //echo "Ubicacion del archivo: ".$ruta_completa2."<br>";
                                            $GLOBALS['contador']++;
                                            $no_cancion++;
                                        }
                                    }
                                    //Termina else carga de archivos
                                }
                            }
                            //Esto va despues del while
                            $albumTracksCount = $xml->createElement('albumTracksCount', $no_cancion - 1);
                            $albumTracksCount = $libro->appendChild($albumTracksCount);
                            $no_cancion = 1;
                            $albumCover = $xml->createElement('albumCover', "images/disco.jpg");
                            $albumCover = $libro->appendChild($albumCover);
                            closedir($aux2);
                        }
                    } else {
                        //No son carpetas, por lo tanto no mostramos nada
                    }
                }
            }
            closedir($aux);
        }
    }
    //Creamos el archivo
    $xml->formatOutput = true;
    $el_xml = $xml->saveXML();
    $xml->save('xml/playlistAllAlbums.xml');
}
开发者ID:huicochea,项目名称:play_huico,代码行数:98,代码来源:creaxml.php



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

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