/** * 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); }
public function testSetType() { $m = new ae_MediaModel(); $m->setType('image/png'); $this->assertEquals($m->getType(), 'image/png'); }