当前位置: 首页>>代码示例>>PHP>>正文


PHP Media::getExtension方法代码示例

本文整理汇总了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');
 }
开发者ID:sidz,项目名称:SonataMediaBundle,代码行数:10,代码来源:MediaTest.php

示例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;
 }
开发者ID:pinecreativelabs,项目名称:audition,代码行数:17,代码来源:m2.php

示例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;
 }
开发者ID:pinecreativelabs,项目名称:audition,代码行数:13,代码来源:release_tracks.php


注:本文中的Media::getExtension方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。