1 <?php namespace BookStack\Uploads;
3 use BookStack\Entities\Models\Page;
5 use BookStack\Traits\HasCreatorAndUpdater;
7 class Image extends Model
9 use HasCreatorAndUpdater;
11 protected $fillable = ['name'];
12 protected $hidden = [];
15 * Get a thumbnail for this image.
18 public function getThumb(int $width, int $height, bool $keepRatio = false): string
20 return app()->make(ImageService::class)->getThumbnail($this, $width, $height, $keepRatio);
24 * Get the page this image has been uploaded to.
25 * Only applicable to gallery or drawio image types.
27 public function getPage(): ?Page
29 return $this->belongsTo(Page::class, 'uploaded_to')->first();