From b15a15afbcc5405c3910717a40aa4e6cda3476b0 Mon Sep 17 00:00:00 2001 From: philipp lang Date: Wed, 28 Oct 2020 23:25:57 +0100 Subject: [PATCH] Ad full image --- classes/CompressJob.php | 8 +++++--- models/Attachment.php | 2 +- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/classes/CompressJob.php b/classes/CompressJob.php index 461028a..2c7e4a2 100644 --- a/classes/CompressJob.php +++ b/classes/CompressJob.php @@ -44,22 +44,24 @@ class CompressJob { { [ $width, $height ] = getimagesize($this->fullPath); + Storage::disk($this->disk)->makeDirectory($this->attachment->path); + if ($width > $this->maxFilesize) { $r = Resizer::open($this->fullPath); $r->resize($this->maxFilesize, 0); $r->save($this->fullPath); } - [ $width, $height ] = getimagesize($this->fullPath); + $r = Resizer::open($this->fullPath); + $r->save(Storage::disk($this->disk)->path($this->attachment->getVersionPath('full'))); - Storage::disk($this->disk)->makeDirectory($this->attachment->path); + [ $width, $height ] = getimagesize($this->fullPath); foreach ($this->sizes as $w) { if ($width < $w) { continue; } - Storage::disk($this->disk)->makeDirectory($this->attachment->path); $r = Resizer::open($this->fullPath); $r->resize($w, 0); diff --git a/models/Attachment.php b/models/Attachment.php index d4c0cac..c12d31c 100644 --- a/models/Attachment.php +++ b/models/Attachment.php @@ -59,7 +59,7 @@ class Attachment extends Model $ext = preg_quote($this->source->extension, '/'); $name = preg_quote($this->slug, '/'); - return "/^{$path}\/{$name}(-[0-9]+)?\.{$ext}$/"; + return "/^{$path}\/{$name}(-[0-9]+)?(-full)?\.{$ext}$/"; } public function getUrlAttribute() {