예제 #1
0
 public static function build(array $cfg)
 {
     $loader = new GalleryLoader();
     $itemList = new Gallery();
     $itemList->fromJson(ROOT . $cfg['json']);
     $loader->setItemList($itemList);
     $itemHandler = new GalleryItemCreator();
     $itemHandler->setFullImageProps($cfg['full']);
     $itemHandler->setLowImageProps($cfg['low']);
     $loader->setItemHandler($itemHandler);
     return $loader;
 }
예제 #2
0
 public function testDelete()
 {
     $name = pathinfo($this->inputImageName, PATHINFO_FILENAME);
     $fullsrc = $this->config['images']['full']['path'] . $name . '.' . $this->config['images']['full']['ext'];
     $lowsrc = $this->config['images']['low']['path'] . $name . '.' . $this->config['images']['low']['ext'];
     $handler = new GalleryItemCreator();
     $handler->setFullImageProps($this->config['images']['full']);
     $handler->setLowImageProps($this->config['images']['low']);
     $item = $handler->create($this->inputDir . $this->inputImageName);
     $this->assertFileExists(ROOT . $fullsrc);
     $this->assertFileExists(ROOT . $lowsrc);
     $handler->delete($item);
     $this->assertFileNotExists(ROOT . $fullsrc);
     $this->assertFileNotExists(ROOT . $lowsrc);
 }