本文整理汇总了PHP中Media类的典型用法代码示例。如果您正苦于以下问题:PHP Media类的具体用法?PHP Media怎么用?PHP Media使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Media类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: postProcessFastStart
/**
* Specifically for creating fast starting files.
* however it can also be used as a standalone function call from the H264Format object.
*
* @access public
* @author Oliver Lillie
* @param Media $media
* @return Media
*/
public function postProcessFastStart(Media $media)
{
// TODO possibly look at setting -movflags faststart options on ffmpeg instead of this.
// set the yamdi input and output options.
$output = $media->getMediaPath();
$temp_output = $output . '.qtfaststart.' . pathinfo($output, PATHINFO_EXTENSION);
// build the qtfaststart process
$qtfaststart_process = new ProcessBuilder('qtfaststart', $this->_config);
$exec = $qtfaststart_process->add($output)->add($temp_output)->getExecBuffer();
// execute the process.
$exec->setBlocking(true)->execute();
// check for any qt-faststart errors
if ($exec->hasError() === true) {
if (is_file($temp_output) === true) {
//@unlink($temp_output);
}
if ($this->_enforce_qt_faststart_success === true) {
//@unlink($output);
throw new FfmpegProcessPostProcessException('qt-faststart post processing of "' . $output . '" failed. The output file has been removed. Any additional qt-faststart message follows:
' . $exec->getExecutedCommand() . '
' . $exec->getBuffer());
}
// TODO, log or exception not sure as the original file is ok.
} else {
// nope everything went ok. so delete ffmpeg file, and then rename yamdi file to that of the original.
unlink($output);
rename($temp_output, $output);
}
return $media;
}
示例2: combine
public static function combine($type, $files, $compress = false)
{
$root = panel::instance()->roots()->assets() . DS . $type;
$cache = new Media($root . DS . 'panel.' . $type);
$media = new Collection(array_map(function ($file) use($root) {
return new Media($root . DS . str_replace('/', DS, $file));
}, $files));
// get the max modification date
$modified = max($media->pluck('modified'));
if (is_writable($root) and (!$cache->exists() or $cache->modified() < $modified)) {
$cache->remove();
$content = '';
foreach ($media as $asset) {
$content .= $asset->read() . PHP_EOL;
}
if ($compress) {
$content = static::compress($content);
}
f::write($root . DS . 'panel.' . $type, $content);
}
if ($cache->exists()) {
return $type(panel()->urls()->{$type}() . '/panel.' . $type . '?v=' . panel()->version());
}
return $type(array_map(function ($item) use($type) {
return 'panel/assets/' . $type . '/' . $item;
}, $files));
}
示例3: getMediaFile
/**
* Download a media file
* provided the content type
* on successful response of content type
* header
*/
public function getMediaFile()
{
$content = $this->client->get($this->media, array(), FALSE);
$media = new Media();
$media->setData($content);
return $media;
}
示例4: transform
/**
* Transforms an object (media) to a string (id).
*
* @param Media|null $media
*
* @return string
*/
public function transform($media)
{
if (null === $media || !$media instanceof \Apoutchika\MediaBundle\Model\MediaInterface) {
return '';
}
return $media->getId();
}
示例5: InstallFiles
public function InstallFiles()
{
$media = new Media();
$media->addModuleFile('modules/preview/vendor/jquery-1.11.1.min.js');
$media->addModuleFile('modules/preview/xibo-text-render.js');
$media->addModuleFile('modules/preview/xibo-layout-scaler.js');
}
示例6: testUpdate
/**
* @group volume
*/
public function testUpdate()
{
print "\n" . __METHOD__ . ' ';
$this->_rootLogin();
$volname = 'pool.file.7d.0001';
// get info
$media = new Media();
$res = $media->getByName($volname);
$mediaid = $res[0]['mediaid'];
$poolid = $res[0]['poolid'];
// update record
$this->request->setPost(array('mediaid' => $mediaid, 'poolid' => 2, 'volstatus' => 'Append', 'volretention' => 365, 'recycle' => 1, 'slot' => 1, 'inchanger' => 0, 'maxvoljobs' => 99999999, 'maxvolfiles' => 99999, 'comment' => "\n\nmoved\nLorem ipsum dolor sit amet\n"));
$this->request->setMethod('POST');
$this->dispatch('volume/update');
$this->logBody($this->response->outputBody());
// debug log
$this->assertController('volume');
$this->assertAction('update');
// back
$this->resetRequest()->resetResponse();
$this->request->setPost(array('mediaid' => $mediaid, 'poolid' => $poolid, 'volstatus' => 'Append', 'volretention' => 365, 'recycle' => 1, 'slot' => 1, 'inchanger' => 0, 'maxvoljobs' => 999, 'maxvolfiles' => 999, 'comment' => "\n\nback\nLorem ipsum dolor sit amet\n"));
$this->request->setMethod('POST');
$this->dispatch('volume/update');
$this->logBody($this->response->outputBody(), 'a');
// debug log
$this->assertController('volume');
$this->assertAction('update');
}
示例7: updated
public function updated(Media $media)
{
if (is_null($media->getOriginal('model_id'))) {
return;
}
if ($media->manipulations != $media->previousManipulations) {
app(FileManipulator::class)->createDerivedFiles($media);
}
}
示例8: DoCheck
public function DoCheck()
{
AssetLoadManager::register('tableList');
// Search engine
$vo_search_config_settings = SearchEngine::checkPluginConfiguration();
$this->view->setVar('search_config_settings', $vo_search_config_settings);
$this->view->setVar('search_config_engine_name', SearchEngine::getPluginEngineName());
// Media
$t_media = new Media();
$va_plugin_names = $t_media->getPluginNames();
$va_plugins = array();
foreach ($va_plugin_names as $vs_plugin_name) {
if ($va_plugin_status = $t_media->checkPluginStatus($vs_plugin_name)) {
$va_plugins[$vs_plugin_name] = $va_plugin_status;
}
}
$this->view->setVar('media_config_plugin_list', $va_plugins);
// PDF Rendering
$t_pdf_renderer = new PDFRenderer();
$va_plugin_names = PDFRenderer::getAvailablePDFRendererPlugins();
$va_plugins = array();
foreach ($va_plugin_names as $vs_plugin_name) {
if ($va_plugin_status = $t_pdf_renderer->checkPluginStatus($vs_plugin_name)) {
$va_plugins[$vs_plugin_name] = $va_plugin_status;
}
}
$this->view->setVar('pdf_renderer_config_plugin_list', $va_plugins);
// Application plugins
$va_plugin_names = ApplicationPluginManager::getPluginNames();
$va_plugins = array();
foreach ($va_plugin_names as $vs_plugin_name) {
if ($va_plugin_status = ApplicationPluginManager::checkPluginStatus($vs_plugin_name)) {
$va_plugins[$vs_plugin_name] = $va_plugin_status;
}
}
$this->view->setVar('application_config_plugin_list', $va_plugins);
// Barcode generation
$vb_gd_is_available = caMediaPluginGDInstalled(true);
$va_barcode_components = array();
$va_gd = array('name' => 'GD', 'description' => _t('GD is a graphics processing library required for all barcode generation.'));
if (!$vb_gd_is_available) {
$va_gd['errors'][] = _t('Is not installed; barcode printing will not be possible.');
}
$va_gd['available'] = $vb_gd_is_available;
$va_barcode_components['GD'] = $va_gd;
$this->view->setVar('barcode_config_component_list', $va_barcode_components);
// General system configuration issues
if (!(bool) $this->request->config->get('dont_do_expensive_configuration_checks_in_web_ui')) {
ConfigurationCheck::performExpensive();
if (ConfigurationCheck::foundErrors()) {
$this->view->setVar('configuration_check_errors', ConfigurationCheck::getErrors());
}
}
$this->render('config_check_html.php');
}
示例9: getMediaItemMarkup
public static function getMediaItemMarkup($mediaId, $userID, $tenantID)
{
$class = new Media($userID, $tenantID);
try {
$media = $class->getEntity($mediaId);
return Display::getMediaMarkup($media);
} catch (Exception $ex) {
// do anything or just ignore if we can't load? Ignoring for now
//echo '<p>unable to load: ' . $ex->getMessage() . '</p>';
return '<p class="hidden">Unable to load media id=' . $mediaId . '<p>';
}
}
示例10: show
/**
* Display the specified resource.
*
* @param int $id
* @return Response
*/
public function show()
{
$user_id = Auth::id();
$media_model = new Media();
$queue_items = QueueItem::where('user_id', '=', $user_id)->get()->toArray();
foreach ($queue_items as $key => $queue_item) {
$queue_items[$key] = $media_model->getMediaFromAPI($queue_item['imdb_id']);
}
$view_data['queue_items'] = $queue_items;
$view_data['side_nav_page'] = 'queue';
return View::make('queue', $view_data);
}
示例11: allView
public function allView($id_estabelecimento_id)
{
$sql = "SELECT `nome_media` FROM `nome_media` WHERE `id_estabelecimento_id` = {$id_estabelecimento_id} LIMIT 0,1;";
$vai = new MySQLDB();
$result = $vai->ExecuteQuery($sql);
while ($dados = mysql_fetch_array($result)) {
$cliente = new Media();
$cliente->setnome_media(array('nome_media' => $dados['nome_media']));
$arr[] = $cliente;
}
return $arr;
}
示例12: photoAttachment
public function photoAttachment(CModel $model, $attr, Media $media)
{
static $count = 0;
$count++;
$html = '';
$html .= CHtml::openTag('div', array('class' => 'photo-attachment-container'));
$html .= $media->getImage(false, array('class' => 'photo-attachment dummy-attachment'));
$html .= CHtml::tag('div', array('class' => 'remove-attachment-button', 'id' => 'remove-attachment-button-' . $count), X2Html::fa('circle') . X2Html::fa('times-circle-o'));
$html .= $this->hiddenField($model, $attr . '[]', array('value' => $media->id));
$html .= CHtml::closeTag('div');
Yii::app()->clientScript->registerScript('MobileActiveForm::photoAttachment' . $count, "\n \$('#remove-attachment-button-{$count}').click (function () {\n \$(this).parent ().remove ();\n });\n ");
return $html;
}
示例13: getMediaMarkup
public static function getMediaMarkup(\Media $Media)
{
switch ($Media->Class) {
case 'AudioMedia':
return '<a href="' . $Media->WebPath . '" title="' . htmlspecialchars($Media->Caption) . '" class="media-link audio-link">' . '<img src="' . $Media->getThumbnailRequest(static::$thumbWidth, static::$thumbHeight) . '" alt="' . htmlspecialchars($Media->Caption) . '">' . '</a>';
case 'VideoMedia':
return '<div title="' . htmlspecialchars($Media->Caption) . '" class="media-link video-link" id="player-' . $Media->ID . '" style="width:425px;height:300px;">' . '<img src="' . $Media->getThumbnailRequest(static::$thumbWidth, static::$thumbHeight) . '" alt="' . htmlspecialchars($Media->Caption) . '">' . '</div><script>flowplayer("player-' . $Media->ID . '", "/swf/flowplayer-3.2.15.swf",{playlist:["' . $Media->WebPath . '"]})</script>';
case 'PDFMedia':
return '<a href="' . $Media->WebPath . '" title="' . htmlspecialchars($Media->Caption) . '" class="media-link pdf-link">' . '<img src="' . $Media->getThumbnailRequest(static::$thumbWidth, static::$thumbHeight) . '" alt="' . htmlspecialchars($Media->Caption) . '">' . '</a>';
case 'PhotoMedia':
default:
return '<figure class="media-figure">' . '<a href="' . $Media->WebPath . '" title="' . htmlspecialchars($Media->Caption) . '" class="media-link image-link">' . '<img class="media-img" src="' . $Media->getThumbnailRequest(static::$fullWidth, static::$fullHeight) . '" alt="' . htmlspecialchars($Media->Caption) . '">' . '</a>' . ($Media->Caption ? '<figcaption class="media-caption">' . htmlspecialchars($Media->Caption) . '</figcaption>' : '') . '</figure>';
}
}
示例14: __toString
public function __toString()
{
/**
* make a new file on catapult when we receive an anchor
* usage follows:
*
* @/storage/my.wav => https://api.catapult.inetwork.com/v1/users/u-xxx/media/my
*/
if (preg_match("/^@/", $this->url, $m)) {
$media = new Media();
$media->create(array("file" => preg_replace("/^@/", "", $this->url), "mediaName" => $this->name));
}
return $this->url;
}
示例15: parse
function parse($value)
{
if ($value == '') {
return null;
}
// First attempt to create media with predefined name
if (preg_match('/^(\\w+)(?:\\s+(portrait|landscape))?$/', $value, $matches)) {
$name = $matches[1];
$landscape = isset($matches[2]) && $matches[2] == 'landscape';
$media =& Media::predefined($name);
if (is_null($media)) {
return null;
}
return array('size' => array('width' => $media->get_width(), 'height' => $media->get_height()), 'landscape' => $landscape);
}
// Second, attempt to create media with predefined size
$parts = preg_split('/\\s+/', $value);
$width_str = $parts[0];
$height_str = isset($parts[1]) ? $parts[1] : $parts[0];
$width = units2pt($width_str);
$height = units2pt($height_str);
if ($width == 0 || $height == 0) {
return null;
}
return array('size' => array('width' => $width / mm2pt(1) / pt2pt(1), 'height' => $height / mm2pt(1) / pt2pt(1)), 'landscape' => false);
}