This commit is contained in:
2024-06-12 19:51:41 +02:00
parent 154e79aacd
commit 0ce904a7d8
18 changed files with 104 additions and 146 deletions

View File

@@ -18,6 +18,7 @@ class Image extends Model implements HasThumbnail
*/
protected $attributes = [
'isCover' => false,
'isProcessing' => true,
'lightboxWidth' => 0,
'lightboxHeight' => 0,
];
@@ -27,7 +28,7 @@ class Image extends Model implements HasThumbnail
*
* @var array
*/
protected $fillable = ['album_id', 'lightboxWidth', 'lightboxHeight'];
protected $fillable = ['album_id', 'lightboxWidth', 'lightboxHeight', 'isCover', 'isProcessing'];
public function album(): BelongsTo
{
@@ -35,11 +36,11 @@ class Image extends Model implements HasThumbnail
}
public function getThumbnail() : string {
return route('image.thumbnail', $this);
return route('image.thumbnail', $this) . '?cacheBuster3000=' . $this->updated_at->timestamp;
}
public function getDownload() : string {
return route('image.download', $this);
return route('image.download', $this) . '?cacheBuster3000=' . $this->updated_at->timestamp;
}
public function setLightboxSize(int $width, int $height) : void {
@@ -50,7 +51,7 @@ class Image extends Model implements HasThumbnail
public function getLightboxAttribute() : array {
return [
'location' => route('image.lightbox', $this),
'location' => route('image.lightbox', $this) . '?cacheBuster3000=' . $this->updated_at->timestamp,
'width' => $this->lightboxWidth,
'height' => $this->lightboxHeight,
];