コード例 #1
0
 protected function getDropboxName(File $file, $hash)
 {
     return sprintf('/%s/%s.%s', basename(dirname($file->getPathname())), $hash, $file->getExtension());
 }
コード例 #2
0
 public function testGetExtension()
 {
     $this->file = new File('test.ext');
     $ext = $this->file->getExtension();
     $this->assertEquals('ext', $ext);
 }
コード例 #3
0
 /**
  * @param \Diamante\DeskBundle\Model\Attachment\File $file
  * @return bool
  */
 protected function isImage(File $file)
 {
     $ext = strtolower($file->getExtension());
     return in_array($ext, ['jpg', 'jpeg', 'png', 'gif', 'bmp']);
 }