本文整理汇总了PHP中Media类的典型用法代码示例。如果您正苦于以下问题:PHP Media类的具体用法?PHP Media怎么用?PHP Media使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Media类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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;
}
开发者ID:ravinderphp,项目名称:landlordv2,代码行数:39,代码来源:Mp4.php
示例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));
}
开发者ID:LucasFyl,项目名称:korakia,代码行数:27,代码来源:assets.php
示例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;
}
开发者ID:robtro,项目名称:php-bandwidth,代码行数:13,代码来源:Recording.php
示例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();
}
开发者ID:Vooodoo,项目名称:MediaBundle,代码行数:14,代码来源:MediaToIdTransformer.php
示例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');
}
开发者ID:fignew,项目名称:xibo-cms,代码行数:7,代码来源:finance.module.php
示例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');
}
开发者ID:staser,项目名称:webacula,代码行数:31,代码来源:VolumeControllerTest.php
示例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);
}
}
开发者ID:robgeorgeuk,项目名称:laravel-medialibrary,代码行数:9,代码来源:MediaObserver.php
示例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');
}
开发者ID:idiscussforum,项目名称:providence,代码行数:55,代码来源:ConfigurationCheckController.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>';
}
}
开发者ID:robertmoss,项目名称:foodfinder_main,代码行数:12,代码来源:display.php
示例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);
}
开发者ID:jcanver,项目名称:seenjump,代码行数:18,代码来源:QueueController.php
示例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;
}
开发者ID:GlauberF,项目名称:Portal-curso-Online,代码行数:12,代码来源:media.class.php
示例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;
}
开发者ID:tymiles003,项目名称:X2CRM,代码行数:13,代码来源:MobileActiveForm.php
示例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>';
}
}
开发者ID:nbey,项目名称:Emergence-Skeleton,代码行数:14,代码来源:Media.php
示例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;
}
开发者ID:robtro,项目名称:php-bandwidth,代码行数:14,代码来源:MediaURL.php
示例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);
}
开发者ID:dadigo,项目名称:simpleinvoices,代码行数:26,代码来源:css.size.inc.php
示例16: parseRequest
public static function parseRequest($url, &$controllerContext)
{
$userRegex = self::getUserRegex();
$modulesRegex = self::getAvailableModulesRegex();
$mediaParts = array_map(['Media', 'toString'], Media::getConstList());
$mediaRegex = implode('|', $mediaParts);
$regex = '^/?' . '(' . $userRegex . ')' . '(' . $modulesRegex . ')' . '(,(' . $mediaRegex . '))?' . '/?($|\\?)';
if (!preg_match('#' . $regex . '#', $url, $matches)) {
return false;
}
$controllerContext->userName = $matches[1];
$media = !empty($matches[4]) ? $matches[4] : 'anime';
switch ($media) {
case 'anime':
$controllerContext->media = Media::Anime;
break;
case 'manga':
$controllerContext->media = Media::Manga;
break;
default:
throw new BadMediaException();
}
$rawModule = ltrim($matches[2], '/') ?: 'profile';
$controllerContext->rawModule = $rawModule;
$controllerContext->module = self::getModuleByUrlPart($rawModule);
assert(!empty($controllerContext->module));
return true;
}
开发者ID:Lucas8x,项目名称:graph,代码行数:28,代码来源:UserController.php
示例17: __construct
function __construct($file, $mimeType = null)
{
$message = "CssMedia::__construct - ";
$message .= "All functionality related to assets has been deprecated.";
trigger_error($message, E_USER_NOTICE);
parent::__construct($file, $mimeType);
}
开发者ID:razzman,项目名称:media,代码行数:7,代码来源:CssMedia.php
示例18: hookDisplayHeader
public function hookDisplayHeader()
{
if ($this->algolia->isConfigurationValid() === false) {
return false;
}
require_once dirname(__FILE__) . '/classes/AlgoliaSearch.php';
require_once dirname(__FILE__) . '/classes/AlgoliaSync.php';
/* Generate Algolia front controller link for search form */
$search_url = Context::getContext()->link->getModuleLink('algolia', 'search');
$this->context->smarty->assign('algolia_search_url', $search_url);
/* Add JS values for Algolia scripts */
$algolia_search = new AlgoliaSearch();
$algolia_sync = new AlgoliaSync();
$language = Context::getContext()->language;
$algolia_sync_settings = $algolia_sync->getSettings($language->id);
Media::addJsDef(array('algolia_application_id' => $algolia_search->getApplicationID(), 'algolia_index_name' => $algolia_search->getIndexName(), 'algolia_search_iso_code' => $language->iso_code, 'algolia_search_only_api_key' => $algolia_search->getSearchOnlyAPIKey(), 'algolia_search_url' => $search_url, 'algolia_attributes_to_index' => $algolia_sync_settings['attributesToIndex'], 'algolia_attributes_for_faceting' => $algolia_sync_settings['attributesForFaceting']));
/* Add CSS & JS files required for Algolia search */
$this->context->controller->addJS($this->_path . '/js/typeahead.bundle.js');
$this->context->controller->addJS($this->_path . '/js/hogan-3.0.1.js');
$this->context->controller->addJS($this->_path . '/js/algoliasearch.min.js');
$this->context->controller->addCSS($this->_path . '/css/algolia.css');
/**
* Load the appropriate JS search script
* Depending on the search method
*/
if (Configuration::get('ALGOLIA_SEARCH_TYPE') == Algolia::Facet_Search) {
$this->context->controller->addJS($this->_path . '/js/algolia_facet_search.js');
} elseif (Configuration::get('ALGOLIA_SEARCH_TYPE') == Algolia::Simple_Search) {
$this->context->controller->addJS($this->_path . '/js/algolia_simple_search.js');
}
}
开发者ID:matiasmenker,项目名称:algoliasearch-prestashop,代码行数:31,代码来源:algolia.php
示例19: action_get_index_collection
public function action_get_index_collection()
{
// Get the post query
$posts_query = $this->_build_query();
// Get the count of ALL records
$count_query = clone $posts_query;
$total_records = (int) $count_query->select(array(DB::expr('COUNT(DISTINCT `post`.`id`)'), 'records_found'))->limit(NULL)->offset(NULL)->find_all()->get('records_found');
// Fetch posts from db
$posts = $posts_query->find_all();
// Get query count
$post_query_sql = $posts_query->last_query();
// Generate filename using hashed query params and ids
$filename = 'export-' . hash('sha256', implode('-', $this->request->query()) . '~' . '-' . $this->request->param('id')) . '.csv';
// Get existing tsv file
$tsv_file = Kohana::$config->load('media.media_upload_dir') . $filename;
// Only generate a new if the file doesn't exist
if (!file_exists($tsv_file)) {
// Supported headers for the TSV file
$tsv_headers = array("ID", "PARENT", "USER", "FORM", "TITLE", "CONTENT", "TYPE", "STATUS", "SLUG", "LOCALE", "CREATED", "UPDATED", "TAGS", "SETS");
// Generate tab separated values (tsv)
$tsv_text = $this->_generate_tsv($tsv_headers, $posts);
// Write tsv to file
$this->_write_tsv_to_file($tsv_text, $filename);
}
// Relative path
$relative_path = str_replace(APPPATH . 'media' . DIRECTORY_SEPARATOR, '', Kohana::$config->load('media.media_upload_dir'));
// Build download link
$download_link = URL::site(Media::uri($relative_path . $filename), Request::current());
// Respond with download link and record count
$this->_response_payload = array('total_count' => $total_records, 'link' => $download_link);
}
开发者ID:kwameboame,项目名称:platform,代码行数:31,代码来源:Export.php
示例20: init
function init()
{
// Include the class file and create Html2ps instance
App::import('vendor', 'Html2PsConfig', array('file' => 'html2ps' . DS . 'config.inc.php'));
App::import('vendor', 'Html2Ps', array('file' => 'html2ps' . DS . 'pipeline.factory.class.php'));
parse_config_file(APP . 'vendors' . DS . 'html2ps' . DS . 'html2ps.config');
global $g_config;
$g_config = array('cssmedia' => 'screen', 'renderimages' => true, 'renderforms' => false, 'renderlinks' => true, 'mode' => 'html', 'debugbox' => false, 'draw_page_border' => false);
$this->media = Media::predefined('A4');
$this->media->set_landscape(false);
$this->media->set_margins(array('left' => 0, 'right' => 0, 'top' => 0, 'bottom' => 0));
$this->media->set_pixels(1024);
global $g_px_scale;
$g_px_scale = mm2pt($this->media->width() - $this->media->margins['left'] - $this->media->margins['right']) / $this->media->pixels;
global $g_pt_scale;
$g_pt_scale = $g_pt_scale * 1.43;
$this->p = PipelineFactory::create_default_pipeline("", "");
switch ($this->output) {
case 'download':
$this->p->destination = new DestinationDownload($this->filename);
break;
case 'file':
$this->p->destination = new DestinationFile($this->filename);
break;
default:
$this->p->destination = new DestinationBrowser($this->filename);
break;
}
}
开发者ID:raveebhat,项目名称:app,代码行数:29,代码来源:pdf.php
注:本文中的Media类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论