1 <?php namespace BookStack\Uploads;
3 use BookStack\Entities\Models\Page;
5 use BookStack\Traits\HasCreatorAndUpdater;
8 class Image extends Model
10 use HasCreatorAndUpdater;
12 protected $fillable = ['name'];
13 protected $hidden = [];
16 * Get a thumbnail for this image.
19 * @param bool|false $keepRatio
23 public function getThumb($width, $height, $keepRatio = false)
25 return Images::getThumbnail($this, $width, $height, $keepRatio);
29 * Get the page this image has been uploaded to.
30 * Only applicable to gallery or drawio image types.
33 public function getPage()
35 return $this->belongsTo(Page::class, 'uploaded_to')->first();