public function testGetFilePath() { $m = new ae_MediaModel(); $m->setName('test.png'); $m->setDatetime('2014-10-22 18:36:04'); $this->assertEquals($m->getFilePathNoName(), '2014/10/'); $this->assertEquals($m->getFilePath(), '2014/10/test.png'); }
/** * Create and save a preview of an uploaded image. * @param {ae_MediaModel} $m The media model of the image. */ protected function createImagePreview(ae_MediaModel $m) { $path = $this->mediaPath . $m->getFilePath(); $previewPath = explode('/', $path); array_pop($previewPath); array_push($previewPath, 'tiny', $m->getName()); $previewPath = implode('/', $previewPath); try { $img = new ae_Image($path, $m->getType()); } catch (Exception $exc) { return FALSE; } $img->resize(IMAGE_PREVIEW_MAX_WIDTH); $img->saveFile($previewPath); }