本文整理汇总了PHP中Media::getFilePath方法的典型用法代码示例。如果您正苦于以下问题:PHP Media::getFilePath方法的具体用法?PHP Media::getFilePath怎么用?PHP Media::getFilePath使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Media
的用法示例。
在下文中一共展示了Media::getFilePath方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: MG_videoThumbnail
function MG_videoThumbnail($aid, $srcImage, $media_filename)
{
global $_MG_CONF;
if ($_MG_CONF['ffmpeg_enabled'] == 1) {
$pThumbnail = Media::getFilePath('tn', $media_filename, 'jpg', 1);
$ffmpeg_cmd = sprintf('"' . $_MG_CONF['ffmpeg_path'] . '/ffmpeg' . '" ' . $_MG_CONF['ffmpeg_command_args'], $srcImage, $pThumbnail);
$rc = MG_execWrapper($ffmpeg_cmd);
COM_errorLog("MG Upload: FFMPEG returned: " . $rc);
if ($rc != 1) {
@unlink($pThumbnail);
return 0;
}
return 1;
}
return 0;
}
示例2: dialplan
public static function dialplan($number)
{
$autoattendant = $number['Destination'];
$doc = Telephony::getDriver()->doc;
$doc->setCurrentNumber('i');
$doc->add('Return', 1);
$doc->setCurrentNumber('t');
$doc->add('Return', 1);
$doc->setCurrentNumber('h');
$doc->add('Return', 1);
foreach ($autoattendant['keys'] as $key) {
if (!isset($key['digits'])) {
continue;
}
if ($transfer = astrsk::getTransferToNumber($key['number_id'])) {
$doc->setCurrentNumber($key['digits']);
$doc->add('Goto(' . $transfer . ')', 1);
}
}
// Don't forget to set the position back to where it was before
$doc->setCurrentNumber('_X.');
$doc->add('Answer', 1);
$doc->add('Set(TIMEOUT(digit)=' . $autoattendant['digit_timeout'] . ')');
$doc->add('Set(TIMEOUT(response)=' . $autoattendant['timeout'] . ')');
if (!empty($autoattendant['registry']['max-failures'])) {
$doc->add('Set(f=' . $autoattendant['registry']['max-failures'] . ')');
} else {
$doc->add('Set(f=3)');
}
if (empty($autoattendant['registry']['mediafile_id']) or !class_exists('Media')) {
$type = 'tty';
} else {
$type = $autoattendant['registry']['type'];
}
switch ($type) {
case 'audio':
$doc->add('Background("' . Media::getFilePath($autoattendant['registry']['mediafile_id']) . '")', 'REPEAT');
break;
default:
$doc->add('WaitExten(5)', 'REPEAT');
}
$doc->add('WaitExten(5)');
$doc->add('Set(f=$[${f} - 1])');
$doc->add('GotoIf($[${f} > 0]?REPEAT)');
}
示例3: MG_mediaEdit
function MG_mediaEdit($album_id, $media_id, $actionURL = '', $mqueue = 0, $view = 0, $back = '')
{
global $_USER, $_CONF, $_MG_CONF, $_TABLES, $_MG_CONF, $LANG_MG00, $LANG_MG01, $LANG_MG03, $LANG_MG07, $_DB_dbms;
$album = new mgAlbum($album_id);
if ($actionURL == '') {
$actionURL = $_MG_CONF['site_url'] . '/index.php';
}
$retval = '';
$T = COM_newTemplate(MG_getTemplatePath($album_id));
$T->set_file(array('admin' => 'mediaedit.thtml', 'asf_options' => 'edit_asf_options.thtml', 'mp3_options' => 'edit_mp3_options.thtml', 'swf_options' => 'edit_swf_options.thtml', 'mov_options' => 'edit_mov_options.thtml', 'flv_options' => 'edit_flv_options.thtml'));
// pull the media information from the database...
$sql = "SELECT * FROM ";
if ($_DB_dbms == "mssql") {
$sql = "SELECT *,CAST(media_desc AS TEXT) AS media_desc FROM ";
}
$sql .= ($mqueue ? $_TABLES['mg_mediaqueue'] : $_TABLES['mg_media']) . " WHERE media_id='" . addslashes($media_id) . "'";
$result = DB_query($sql);
$row = DB_fetchArray($result);
if ($album->access != 3 && !SEC_inGroup($album->mod_group_id) && $row['media_user_id'] != $_USER['uid']) {
COM_errorLog("Someone has tried to illegally sort albums in Media Gallery. " . "User id: {$_USER['uid']}, Username: {$_USER['username']}, IP: {$REMOTE_ADDR}", 1);
return COM_showMessageText($LANG_MG00['access_denied_msg']);
}
// Build Album List
$album_jumpbox = '<select name="albums" width="40">';
$root_album = new mgAlbum(0);
$root_album->buildJumpBox($album_jumpbox, $album_id);
$album_jumpbox .= '</select>';
// should check the above for errors, etc...
$exif_info = '';
if ($row['media_type'] == 0) {
if (!function_exists('MG_readEXIF')) {
require_once $_CONF['path'] . 'plugins/mediagallery/include/lib-exif.php';
}
$exif_info = MG_readEXIF($row['media_id'], 1, $mqueue);
if (empty($exif_info)) {
$exif_info = '';
}
}
$media_time_month = date("m", $row['media_time']);
$media_time_day = date("d", $row['media_time']);
$media_time_year = date("Y", $row['media_time']);
$media_time_hour = date("H", $row['media_time']);
$media_time_minute = date("i", $row['media_time']);
$month_select = '<select name="media_month">';
$month_select .= COM_getMonthFormOptions($media_time_month);
$month_select .= '</select>';
$day_select = '<select name="media_day">';
for ($i = 1; $i < 32; $i++) {
$day_select .= '<option value="' . $i . '"' . ($media_time_day == $i ? 'selected="selected"' : "") . '>' . $i . '</option>';
}
$day_select .= '</select>';
$current_year = (int) date("Y");
$end_year = $current_year + 10;
$year_select = '<select name="media_year">';
for ($i = 1998; $i < $end_year; $i++) {
$year_select .= '<option value="' . $i . '"' . ($media_time_year == $i ? 'selected="selected"' : "") . '>' . $i . '</option>';
}
$year_select .= '</select>';
$hour_select = '<select name="media_hour">';
for ($i = 0; $i < 24; $i++) {
$hour_select .= '<option value="' . $i . '"' . ($media_time_hour == $i ? 'selected="selected"' : "") . '>' . $i . '</option>';
}
$hour_select .= '</select>';
$minute_select = '<select name="media_minute">';
for ($i = 0; $i < 60; $i++) {
$minute_select .= '<option value="' . $i . '"' . ($media_time_minute == $i ? 'selected="selected"' : "") . '>' . ($i < 10 ? '0' : '') . $i . '</option>';
}
$minute_select .= '</select>';
$media_time = MG_getUserDateTimeFormat($row['media_time']);
$tn_size = 1;
list($thumbnail, $pThumbnail, $size) = Media::getThumbInfo($row, $tn_size);
$attached_thumbnail = '';
if ($row['media_tn_attached'] == 1) {
$atnsize = '';
if ($size != false) {
list($newwidth, $newheight) = Media::getImageWH($size[0], $size[1], 150, 150);
$atnsize = 'width="' . $newwidth . '" height="' . $newheight . '"';
}
$attached_thumbnail = '<img src="' . $thumbnail . '" alt="" ' . $atnsize . XHTML . '>';
$tmpthumb = Media::getDefaultThumbnail($row, $tn_size);
$thumbnail = $_MG_CONF['mediaobjects_url'] . '/' . $tmpthumb;
$size = getimagesize($_MG_CONF['path_mediaobjects'] . $tmpthumb);
}
$preview = '';
$preview_end = '';
if ($row['media_type'] == 0 || $row['media_type'] == 1 || $row['media_type'] == 2) {
// image, video and music file
if ($row['media_type'] == 2) {
$win_width = 540;
$win_height = 320;
} elseif ($row['media_type'] == 1) {
$win_width = 660;
$win_height = 525;
} elseif ($row['media_type'] == 0) {
$path = Media::getFilePath('disp', $row['media_filename'], $row['media_mime_ext']);
$media_size_disp = @getimagesize($path);
$win_width = $media_size_disp[0] + 20;
$win_height = $media_size_disp[1] + 20;
} else {
$win_width = 800;
//.........这里部分代码省略.........
示例4: testGetFilePath
public function testGetFilePath()
{
$image = $this->media("bg");
$expected = implode(DIRECTORY_SEPARATOR, array('uploads', $image->fileName));
$this->assertEquals($expected, Media::getFilePath(null, $image->fileName));
}
示例5: foreach
echo $minimizeLink;
?>
<br>
<div id="<?php
echo $user['username'];
?>
-media" class="user-media-list">
<?php
foreach ($userMediaItems as $item) {
if (!$item['private'] || $admin) {
$baseId = "{$user['username']}-media-id-{$item['id']}";
$jsSelectorId = CJSON::encode("#{$baseId}");
$propertyId = addslashes($baseId);
$desc = CHtml::encode($item['description']);
echo '<span class="x2-pillbox media-item">';
$path = Media::getFilePath($item['uploadedBy'], $item['fileName']);
$filename = $item['drive'] ? $item['name'] : $item['fileName'];
if (mb_strlen($filename, 'UTF-8') > 35) {
$filename = mb_substr($filename, 0, 32, 'UTF-8') . '…';
}
echo CHtml::link($filename, array('/media', 'view' => $item['id']), array('class' => 'x2-link media media-library-item' . (Media::isImageExt($item['fileName']) ? ' image-file' : ''), 'id' => $baseId, 'data-url' => Media::model()->findByPk($item['id'])->getPublicUrl()));
echo '</span>';
if (Media::isImageExt($item['fileName'])) {
$imageLink = Media::getFileUrl($path);
$image = CHtml::image($imageLink, '', array('class' => 'media-hover-image'));
$imageStr = CJSON::encode($image);
if ($item['description']) {
$content = CJSON::encode("<span style=\"max-width: 200px;\">{$image} {$desc}</span>");
$imageTooltips .= "\$({$jsSelectorId}).qtip({content: {$content}, position: {my: 'top right', at: 'bottom left'}});\n";
} else {
$imageTooltips .= "\$({$jsSelectorId}).qtip({content: {$imageStr}, position: {my: 'top right', at: 'bottom left'}});\n";
示例6: MG_updateQuotaUsage
function MG_updateQuotaUsage($album_id)
{
global $_CONF, $_TABLES;
require_once $_CONF['path'] . 'plugins/mediagallery/include/classMedia.php';
// update the disk usage...
$quota = 0;
$sql = MG_buildMediaSql(array('album_id' => $album_id, 'fields' => array('media_filename', 'media_mime_ext'), 'sortorder' => -1));
$result = DB_query($sql);
$nRows = DB_numRows($result);
while (list($filename, $mime_ext) = DB_fetchArray($result)) {
$orig = Media::getFilePath('orig', $filename, $mime_ext);
if (file_exists($orig)) {
$quota += @filesize($orig);
}
$disp = Media::getFilePath('disp', $filename);
if (file_exists($disp)) {
$quota += @filesize($disp);
}
$ext = pathinfo($disp, PATHINFO_EXTENSION);
$tn = Media::getFilePath('tn', $filename, $ext);
if (file_exists($tn)) {
$quota += @filesize($tn);
}
$types = array('0', '1', '2', '3', '10', '11', '12', '13');
foreach ($types as $t) {
$fpath = Media::getThumbPath($tn, $t);
if (file_exists($fpath)) {
$quota += @filesize($fpath);
}
}
}
if ($nRows > 0) {
DB_change($_TABLES['mg_albums'], 'album_disk_usage', $quota, 'album_id', intval($album_id));
}
}