本文整理汇总了PHP中MediaHelper::parseSize方法的典型用法代码示例。如果您正苦于以下问题:PHP MediaHelper::parseSize方法的具体用法?PHP MediaHelper::parseSize怎么用?PHP MediaHelper::parseSize使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MediaHelper
的用法示例。
在下文中一共展示了MediaHelper::parseSize方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: defined
* @subpackage com_media
* @copyright Copyright (C) 2005 - 2013 Open Source Matters, Inc. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
// No direct access.
defined('_JEXEC') or die;
$params = new JRegistry();
$dispatcher = JDispatcher::getInstance();
$dispatcher->trigger('onContentBeforeDisplay', array('com_media.file', &$this->_tmp_img, &$params));
?>
<div class="item">
<a href="javascript:ImageManager.populateFields('<?php
echo $this->_tmp_img->path_relative;
?>
')" title="<?php
echo $this->_tmp_img->name;
?>
" >
<?php
echo JHtml::_('image', $this->baseURL . '/' . $this->_tmp_img->path_relative, JText::sprintf('COM_MEDIA_IMAGE_TITLE', $this->_tmp_img->title, MediaHelper::parseSize($this->_tmp_img->size)), array('width' => $this->_tmp_img->width_60, 'height' => $this->_tmp_img->height_60));
?>
<span title="<?php
echo $this->_tmp_img->name;
?>
"><?php
echo $this->_tmp_img->title;
?>
</span></a>
</div>
<?php
$dispatcher->trigger('onContentAfterDisplay', array('com_media.file', &$this->_tmp_img, &$params));
示例2: defined
*/
// No direct access.
defined('_JEXEC') or die;
?>
<div class="item">
<a href="javascript:ImageManager.populateFields('<?php
echo $this->_tmp_img->path_relative;
?>
')">
<img src="<?php
echo $this->baseURL . '/' . $this->_tmp_img->path_relative;
?>
" width="<?php
echo $this->_tmp_img->width_60;
?>
" height="<?php
echo $this->_tmp_img->height_60;
?>
" alt="<?php
echo $this->_tmp_img->name;
?>
- <?php
echo MediaHelper::parseSize($this->_tmp_img->size);
?>
" />
<span><?php
echo $this->_tmp_img->name;
?>
</span></a>
</div>
示例3: getList
function getList()
{
static $list;
// Only process the list once per request
if (is_array($list)) {
return $list;
}
// Get current path from request
$current = $this->getState('folder');
// If undefined, set to empty
if ($current == 'undefined') {
$current = '';
}
// Initialize variables
if (strlen($current) > 0) {
$basePath = Citruscart::getPath('images') . DS . $current;
} else {
$basePath = Citruscart::getPath('images');
}
$mediaBase = str_replace(DS, '/', Citruscart::getPath('images') . '/');
$images = array();
$folders = array();
$docs = array();
// Get the list of files and folders from the given folder
$fileList = JFolder::files($basePath);
$folderList = JFolder::folders($basePath);
// Iterate over the files if they exist
if ($fileList !== false) {
foreach ($fileList as $file) {
if (is_file($basePath . DS . $file) && substr($file, 0, 1) != '.' && strtolower($file) !== 'index.html') {
$tmp = new JObject();
$tmp->name = $file;
$tmp->path = str_replace(DS, '/', JPath::clean($basePath . DS . $file));
$tmp->path_relative = str_replace($mediaBase, '', $tmp->path);
$tmp->size = filesize($tmp->path);
$ext = strtolower(JFile::getExt($file));
switch ($ext) {
// Image
case 'jpg':
case 'png':
case 'gif':
case 'xcf':
case 'odg':
case 'bmp':
case 'jpeg':
$info = getimagesize($tmp->path);
$tmp->width = $info[0];
$tmp->height = $info[1];
$tmp->type = $info[2];
$tmp->mime = $info['mime'];
$filesize = MediaHelper::parseSize($tmp->size);
if ($info[0] > 60 || $info[1] > 60) {
$dimensions = MediaHelper::imageResize($info[0], $info[1], 60);
$tmp->width_60 = $dimensions[0];
$tmp->height_60 = $dimensions[1];
} else {
$tmp->width_60 = $tmp->width;
$tmp->height_60 = $tmp->height;
}
if ($info[0] > 16 || $info[1] > 16) {
$dimensions = MediaHelper::imageResize($info[0], $info[1], 16);
$tmp->width_16 = $dimensions[0];
$tmp->height_16 = $dimensions[1];
} else {
$tmp->width_16 = $tmp->width;
$tmp->height_16 = $tmp->height;
}
$images[] = $tmp;
break;
// Non-image document
// Non-image document
default:
$iconfile_32 = JPATH_ADMINISTRATOR . "/components/com_media/images/mime-icon-32/" . $ext . ".png";
if (file_exists($iconfile_32)) {
$tmp->icon_32 = "components/com_media/images/mime-icon-32/" . $ext . ".png";
} else {
$tmp->icon_32 = "components/com_media/images/con_info.png";
}
$iconfile_16 = JPATH_ADMINISTRATOR . "/components/com_media/images/mime-icon-16/" . $ext . ".png";
if (file_exists($iconfile_16)) {
$tmp->icon_16 = "components/com_media/images/mime-icon-16/" . $ext . ".png";
} else {
$tmp->icon_16 = "components/com_media/images/con_info.png";
}
$docs[] = $tmp;
break;
}
}
}
}
// Iterate over the folders if they exist
if ($folderList !== false) {
foreach ($folderList as $folder) {
$tmp = new JObject();
$tmp->name = basename($folder);
$tmp->path = str_replace(DS, '/', JPath::clean($basePath . DS . $folder));
$tmp->path_relative = str_replace($mediaBase, '', $tmp->path);
$count = MediaHelper::countFiles($tmp->path);
$tmp->files = $count[0];
$tmp->folders = $count[1];
//.........这里部分代码省略.........
示例4:
?>
<div class="imgOutline">
<div class="imgTotal">
<div class="imgBorder center">
<a class="img-preview" href="<?php
echo COM_MEDIA_BASEURL . '/' . $this->_tmp_img->path_relative;
?>
" title="<?php
echo $this->_tmp_img->name;
?>
" style="display: block; width: 100%; height: 100%">
<img src="<?php
echo COM_MEDIA_BASEURL . '/' . $this->_tmp_img->path_relative;
?>
" alt="<?php
echo Lang::txt('COM_MEDIA_IMAGE_TITLE', $this->_tmp_img->title, MediaHelper::parseSize($this->_tmp_img->size));
?>
" width="<?php
echo $this->_tmp_img->width_60;
?>
" height="<?php
echo $this->_tmp_img->height_60;
?>
" />
</a>
</div>
</div>
<div class="controls">
<?php
if (User::authorise('core.delete', 'com_media')) {
?>
示例5:
')">
<img
src="<?php
echo $this->baseURL . '/' . $this->_tmp_img->path_relative;
?>
"
class="jsn-graphic-showcase"
width="<?php
echo $this->_tmp_img->width_60;
?>
"
height="<?php
echo $this->_tmp_img->height_60;
?>
"
alt="<?php
echo $this->_tmp_img->name;
?>
- <?php
echo $objPlgMediaHelper->parseSize($this->_tmp_img->size);
?>
" />
<span> <?php
echo $this->_tmp_img->name;
?>
<br /> <?php
echo $this->_tmp_img->width . 'x' . $this->_tmp_img->height;
?>
</span> </a>
</div>