本文整理汇总了PHP中Media::getExtension方法的典型用法代码示例。如果您正苦于以下问题:PHP Media::getExtension方法的具体用法?PHP Media::getExtension怎么用?PHP Media::getExtension使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Media
的用法示例。
在下文中一共展示了Media::getExtension方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testGetMediaFileExtension
public function testGetMediaFileExtension()
{
$media = new Media();
$media->setProviderReference('https://sonata-project.org/bundles/sonatageneral/images/logo-small.png?some-query-string=1');
$this->assertSame('png', $media->getExtension(), 'extension should not contain query strings');
$media->setProviderReference('https://sonata-project.org/bundles/sonatageneral/images/logo-small.png#some-hash');
$this->assertSame('png', $media->getExtension(), 'extension should not contain hashes');
$media->setProviderReference('https://sonata-project.org/bundles/sonatageneral/images/logo-small.png?some-query-string=1#with-some-hash');
$this->assertSame('png', $media->getExtension(), 'extension should not contain query strings or hashes');
}
示例2: getFileURL
function getFileURL()
{
if ($this->type == 'image') {
// we get the area instance
$url = SITE_WEB_DIRECTORY . MEDIA_BASE_DIRECTORY . '/' . $this->area_id . '/' . $this->filename;
} else {
if ($this->access == 'STREAMING') {
include_class('config');
$conf = new Config();
$streamingAudioServerURL = $conf->getSetting('streamingAudioServerURL');
$url = $streamingAudioServerURL . '/' . basename($this->protected_filename, Media::getExtension($this->protected_filename)) . 'pls';
} else {
$url = SITE_WEB_DIRECTORY . MEDIA_ORIGINALS_DIRECTORY . '/' . date('Ymd', strtotime($this->date_time)) . '/' . $this->filename_original;
}
}
return $url;
}
示例3: generateAudioFilename
function generateAudioFilename($filename)
{
// takes a track ID, generates a unique audio filename that makes sense for that track
// compilation of track name w/underscores, track number, and a random number (if necessary)
// we assume the track ID is valid
require_once CLASSES . '/m2.php';
$title = $this->getNumber() . '_' . Media::sanitizeFile($this->getTitle()) . '.' . Media::getExtension($filename);
if (file_exists(AUDIO_DIRECTORY . '/' . $title)) {
$rand = rand('0000', '9999');
$title = $rand . $title;
}
return $title;
}