示例#1
0
 public function delete(GalleryItem $item)
 {
     $props = $item->toArray();
     if (file_exists(ROOT . $props['fullsrc'])) {
         unlink(ROOT . $props['fullsrc']);
     }
     if (file_exists(ROOT . $props['lowsrc'])) {
         unlink(ROOT . $props['lowsrc']);
     }
 }
示例#2
0
文件: Gallery.php 项目: CiNiK/lisar
 public function add(GalleryItem $image)
 {
     $this->items[] = $image->toArray();
     $this->save();
 }
示例#3
0
 public function testToArray()
 {
     $item = new GalleryItem('img', '2016', 'pathToFull', 'pathToLow');
     $this->assertEquals($item->toArray(), ['description' => 'img', 'category' => '2016', 'fullsrc' => 'pathToFull', 'lowsrc' => 'pathToLow']);
 }