/** * Return file extension from a given filename * * @param string $name * @param boolean $realFile * @link http://php.net/manual/en/function.pathinfo.php * @return false|string string or false */ public static function fileExtension($name, $realFile = false) { return StorageUtils::fileExtension($name, $realFile); }
/** * testFileExtension * * @return void */ public function testFileExtension() { $result = StorageUtils::fileExtension($this->fileFixtures . 'titus.jpg', true); $this->assertEquals($result, 'jpg'); $result = StorageUtils::fileExtension('something.else'); $this->assertEquals($result, 'else'); }
/** * beforeSave * * @param Event $Event * @return void */ public function beforeSave(Event $Event) { if ($this->_checkEvent($Event)) { if (in_array($Event->data['record']['model'], (array) $this->config('autoRotate'))) { $imageFile = $Event->data['record']['file']['tmp_name']; $format = StorageUtils::fileExtension($Event->data['record']['file']['name']); $this->_autoRotate($imageFile, $format); } } }