image processor added

This commit is contained in:
HolgerHatGarKeineNode
2023-02-15 11:25:31 +01:00
parent 5b1d0886dc
commit 2949ff5cb0
22 changed files with 278 additions and 177 deletions

View File

@@ -2,6 +2,7 @@
namespace App\Models;
use Illuminate\Database\Eloquent\Casts\Attribute;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
@@ -91,4 +92,25 @@ class Meetup extends Model implements HasMedia
{
return $this->hasMany(MeetupEvent::class);
}
protected function logoSquare(): Attribute
{
$getPath = $this->getFirstMediaPath('logo');
if ($getPath !== '') {
$path = $this->getFirstMediaPath('logo');
} else {
$path = 'fallback/einundzwanzig.png';
}
return Attribute::make(
get: fn() => url()->route('img',
[
'path' => $path,
'w' => 900,
'h' => 900,
'fit' => 'crop',
'fm' => 'webp'
]),
);
}
}