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() {