本文整理汇总了PHP中Sonata\MediaBundle\Model\MediaInterface::getName方法的典型用法代码示例。如果您正苦于以下问题:PHP MediaInterface::getName方法的具体用法?PHP MediaInterface::getName怎么用?PHP MediaInterface::getName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Sonata\MediaBundle\Model\MediaInterface
的用法示例。
在下文中一共展示了MediaInterface::getName方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getHelperProperties
public function getHelperProperties(MediaInterface $media, $format, $options = array())
{
$format_configuration = $this->getFormat($format);
return array_merge(array(
'title' => $media->getName(),
'src' => $this->generatePublicUrl($media, $format),
'width' => $format_configuration['width'],
), $options);
}
示例2: getHelperProperties
/**
* {@inheritdoc}
*/
public function getHelperProperties(MediaInterface $media, $format, $options = array())
{
/*$getId3 = new GetId3();
$audio = $getId3
->setOptionMD5Data(true)
->setOptionMD5DataSource(true)
->setEncoding('UTF-8')
->analyze($this->root_dir . '/../web' .$this->generatePublicUrl($media, $format))
;*/
return array_merge(array('name' => $media->getName(), 'src' => $this->generatePublicUrl($media, $format), 'filesize' => $media->getMetadataValue('filesize'), 'fileformat' => $media->getMetadataValue('fileformat'), 'encoding' => $media->getMetadataValue('encoding'), 'mime_type' => $media->getMetadataValue('mime_type'), 'playtime_seconds' => $media->getMetadataValue('playtime_seconds'), 'playtime_string' => $media->getMetadataValue('playtime_string'), 'bitrate' => $media->getMetadataValue('bitrate'), 'audio_dataformat' => $media->getMetadataValue('audio_dataformat'), 'audio_codec' => $media->getMetadataValue('audio_codec'), 'audio_sample_rate' => $media->getMetadataValue('audio_sample_rate'), 'audio_channels' => $media->getMetadataValue('audio_channels'), 'audio_bits_per_sample' => $media->getMetadataValue('audio_bits_per_sample'), 'audio_lossless' => $media->getMetadataValue('audio_lossless'), 'audio_channelmode' => $media->getMetadataValue('audio_channelmode'), 'video_dataformat' => $media->getMetadataValue('video_dataformat'), 'video_resolution_x' => $media->getMetadataValue('video_resolution_x'), 'video_resolution_y' => $media->getMetadataValue('video_resolution_y'), 'video_fourcc' => $media->getMetadataValue('video_fourcc'), 'video_frame_rate' => $media->getMetadataValue('video_frame_rate'), 'video_codec' => $media->getMetadataValue('video_codec')), $options);
}
示例3: getHelperProperties
/**
* {@inheritdoc}
*/
public function getHelperProperties(MediaInterface $media, $format, $options = array())
{
return array_merge(array('title' => $media->getName(), 'thumbnail' => $this->getReferenceImage($media), 'file' => $this->getReferenceImage($media), 'media' => $media), $options);
}
示例4: processMedia
/**
* @param MediaInterface $media
* @param MediaProviderInterface $provider
* @param string $context
* @param string $format
*
* @return bool
*/
protected function processMedia(MediaInterface $media, MediaProviderInterface $provider, $context, $format)
{
$this->log('Deleting thumbs for ' . $media->getName() . ' - ' . $media->getId());
try {
if ($format === $context . '_all') {
$format = null;
}
$provider->removeThumbnails($media, $format);
} catch (\Exception $e) {
$this->log(sprintf('<error>Unable to remove thumbnails, media: %s - %s </error>', $media->getId(), $e->getMessage()));
return false;
}
return true;
}
示例5: getHelperProperties
/**
* {@inheritdoc}
*/
public function getHelperProperties(MediaInterface $media, $format, $options = array())
{
/*$getId3 = new GetId3();
$audio = $getId3
->setOptionMD5Data(true)
->setOptionMD5DataSource(true)
->setEncoding('UTF-8')
->analyze($this->root_dir . '/../web' .$this->generatePublicUrl($media, $format))
;*/
return array_merge(array('name' => $media->getName(), 'src' => $this->generatePublicMultimediaUrl($media), 'image_src' => $media->getMetadataValue('image_src'), 'image_mime' => $media->getMetadataValue('image_mime'), 'encoding' => $media->getMetadataValue('encoding'), 'filesize' => $media->getMetadataValue('filesize'), 'mime_type' => $media->getMetadataValue('mime_type'), 'fileformat' => $media->getMetadataValue('fileformat'), 'dataformat' => $media->getMetadataValue('dataformat'), 'channels' => $media->getMetadataValue('channels'), 'sample_rate' => $media->getMetadataValue('sample_rate'), 'bitrate' => $media->getMetadataValue('bitrate'), 'channelmode' => $media->getMetadataValue('channelmode'), 'bitrate_mode' => $media->getMetadataValue('bitrate_mode'), 'title' => $media->getMetadataValue('title'), 'comment' => $media->getMetadataValue('comment'), 'artist' => $media->getMetadataValue('artist'), 'album' => $media->getMetadataValue('album'), 'year' => $media->getMetadataValue('year'), 'track_number' => $media->getMetadataValue('track_number'), 'genre' => $media->getMetadataValue('genre'), 'playtime_seconds' => $media->getMetadataValue('playtime_seconds'), 'playtime_string' => $media->getMetadataValue('playtime_string')), $options);
}
示例6: generateMediaUniqId
/**
* @param \Sonata\MediaBundle\Model\MediaInterface $media
*
* @return string
*/
protected function generateMediaUniqId(MediaInterface $media)
{
return sha1($media->getName() . uniqid() . rand(11111, 99999));
}
示例7: generateReferenceName
/**
* @param \Sonata\MediaBundle\Model\MediaInterface $media
*
* @return string
*/
protected function generateReferenceName(MediaInterface $media)
{
return sha1($media->getName() . rand(11111, 99999)) . '.' . $media->getBinaryContent()->guessExtension();
}
示例8: processMedia
/**
* @param MediaInterface $media
* @param MediaProviderInterface $provider
*
* @return bool
*/
protected function processMedia($media, $provider)
{
$this->log('Generating thumbs for ' . $media->getName() . ' - ' . $media->getId());
try {
$provider->removeThumbnails($media);
} catch (\Exception $e) {
$this->log(sprintf('<error>Unable to remove old thumbnails, media: %s - %s </error>', $media->getId(), $e->getMessage()));
return false;
}
try {
$provider->generateThumbnails($media);
} catch (\Exception $e) {
$this->log(sprintf('<error>Unable to generate new thumbnails, media: %s - %s </error>', $media->getId(), $e->getMessage()));
return false;
}
return true;
}