]> BookStack Code Mirror - bookstack/blob - app/Exports/ZipExportModels/ZipExportImage.php
39f1d10129821d61ededab6fd6beab394e29bf78
[bookstack] / app / Exports / ZipExportModels / ZipExportImage.php
1 <?php
2
3 namespace BookStack\Exports\ZipExportModels;
4
5 use BookStack\Exports\ZipExportFiles;
6 use BookStack\Uploads\Image;
7
8 class ZipExportImage extends ZipExportModel
9 {
10     public ?int $id = null;
11     public string $name;
12     public string $file;
13     public string $type;
14
15     public static function fromModel(Image $model, ZipExportFiles $files): self
16     {
17         $instance = new self();
18         $instance->id = $model->id;
19         $instance->name = $model->name;
20         $instance->type = $model->type;
21         $instance->file = $files->referenceForImage($model);
22
23         return $instance;
24     }
25 }