Ad full image

This commit is contained in:
philipp lang 2020-10-28 23:25:57 +01:00
parent ffc17d5a34
commit b15a15afbc
2 changed files with 6 additions and 4 deletions

View File

@ -44,22 +44,24 @@ class CompressJob {
{ {
[ $width, $height ] = getimagesize($this->fullPath); [ $width, $height ] = getimagesize($this->fullPath);
Storage::disk($this->disk)->makeDirectory($this->attachment->path);
if ($width > $this->maxFilesize) { if ($width > $this->maxFilesize) {
$r = Resizer::open($this->fullPath); $r = Resizer::open($this->fullPath);
$r->resize($this->maxFilesize, 0); $r->resize($this->maxFilesize, 0);
$r->save($this->fullPath); $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) { foreach ($this->sizes as $w) {
if ($width < $w) { if ($width < $w) {
continue; continue;
} }
Storage::disk($this->disk)->makeDirectory($this->attachment->path);
$r = Resizer::open($this->fullPath); $r = Resizer::open($this->fullPath);
$r->resize($w, 0); $r->resize($w, 0);

View File

@ -59,7 +59,7 @@ class Attachment extends Model
$ext = preg_quote($this->source->extension, '/'); $ext = preg_quote($this->source->extension, '/');
$name = preg_quote($this->slug, '/'); $name = preg_quote($this->slug, '/');
return "/^{$path}\/{$name}(-[0-9]+)?\.{$ext}$/"; return "/^{$path}\/{$name}(-[0-9]+)?(-full)?\.{$ext}$/";
} }
public function getUrlAttribute() { public function getUrlAttribute() {