]> BookStack Code Mirror - bookstack/blob - app/Image.php
Started work on drawing revisions
[bookstack] / app / Image.php
1 <?php namespace BookStack;
2
3 use Images;
4
5 class Image extends Ownable
6 {
7
8     protected $fillable = ['name'];
9
10     /**
11      * Get a thumbnail for this image.
12      * @param  int $width
13      * @param  int $height
14      * @param bool|false $keepRatio
15      * @return string
16      * @throws \Exception
17      */
18     public function getThumb($width, $height, $keepRatio = false)
19     {
20         return Images::getThumbnail($this, $width, $height, $keepRatio);
21     }
22
23     /**
24      * Get the revisions for this image.
25      * @return \Illuminate\Database\Eloquent\Relations\HasMany
26      */
27     public function revisions()
28     {
29         return $this->hasMany(ImageRevision::class);
30     }
31 }