fix: modifying borken profile items
This commit is contained in:
parent
a989f3e92b
commit
040deb6456
@ -23,6 +23,7 @@ public function index()
|
||||
$user = auth()->user();
|
||||
$artists = Artist::whereHas('artworks')
|
||||
->withCount('artworks')
|
||||
->withCount('episodes')
|
||||
->orderBy('artworks_count', 'desc')
|
||||
->paginate(100);
|
||||
$podcasts = Podcast::where('published', true)->get();
|
||||
@ -65,6 +66,8 @@ public function show(Request $request, $slug)
|
||||
{
|
||||
$user = auth()->user();
|
||||
$artist = Artist::where('slug', $slug)
|
||||
->withCount('episodes')
|
||||
->withCount('artworks')
|
||||
->firstOrFail();
|
||||
$artworks = Artwork::where('artist_id', $artist->id)
|
||||
->with('episode')
|
||||
|
36
site/app/Jobs/OptimizeArtistHeaderJob.php
Normal file
36
site/app/Jobs/OptimizeArtistHeaderJob.php
Normal file
@ -0,0 +1,36 @@
|
||||
<?php
|
||||
|
||||
namespace App\Jobs;
|
||||
|
||||
use Illuminate\Bus\Queueable;
|
||||
use Illuminate\Contracts\Queue\ShouldBeUnique;
|
||||
use Illuminate\Contracts\Queue\ShouldQueue;
|
||||
use Illuminate\Foundation\Bus\Dispatchable;
|
||||
use Illuminate\Queue\InteractsWithQueue;
|
||||
use Illuminate\Queue\SerializesModels;
|
||||
use ImageOptimizer;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
|
||||
class OptimizeArtistHeaderJob implements ShouldQueue
|
||||
{
|
||||
use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;
|
||||
|
||||
private $path;
|
||||
|
||||
/**
|
||||
* Create a new job instance.
|
||||
*/
|
||||
public function __construct($path)
|
||||
{
|
||||
$this->path = $path;
|
||||
}
|
||||
|
||||
/**
|
||||
* Execute the job.
|
||||
*/
|
||||
public function handle(): void
|
||||
{
|
||||
Log::info('Header: Optimizing ' . $this->path);
|
||||
ImageOptimizer::optimize($this->path);
|
||||
}
|
||||
}
|
36
site/app/Jobs/OptimizeAvatarJob.php
Normal file
36
site/app/Jobs/OptimizeAvatarJob.php
Normal file
@ -0,0 +1,36 @@
|
||||
<?php
|
||||
|
||||
namespace App\Jobs;
|
||||
|
||||
use Illuminate\Bus\Queueable;
|
||||
use Illuminate\Contracts\Queue\ShouldBeUnique;
|
||||
use Illuminate\Contracts\Queue\ShouldQueue;
|
||||
use Illuminate\Foundation\Bus\Dispatchable;
|
||||
use Illuminate\Queue\InteractsWithQueue;
|
||||
use Illuminate\Queue\SerializesModels;
|
||||
use ImageOptimizer;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
|
||||
class OptimizeAvatarJob implements ShouldQueue
|
||||
{
|
||||
use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;
|
||||
|
||||
private $path;
|
||||
|
||||
/**
|
||||
* Create a new job instance.
|
||||
*/
|
||||
public function __construct($path)
|
||||
{
|
||||
$this->path = $path;
|
||||
}
|
||||
|
||||
/**
|
||||
* Execute the job.
|
||||
*/
|
||||
public function handle(): void
|
||||
{
|
||||
Log::info('Avatar: Optimizing ' . $this->path);
|
||||
ImageOptimizer::optimize($this->path);
|
||||
}
|
||||
}
|
@ -11,6 +11,8 @@
|
||||
use Illuminate\Validation\Rules\File;
|
||||
use Illuminate\Http\RedirectResponse;
|
||||
use Livewire\Attributes\Validate;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
use App\Jobs\OptimizeAvatarJob;
|
||||
|
||||
class Avatar extends Component
|
||||
{
|
||||
@ -32,7 +34,6 @@ public function save()
|
||||
{
|
||||
$disk = Storage::disk('static');
|
||||
$avatar = $this->avatar->store('avatars', 'static');
|
||||
|
||||
Image::load($disk->path($avatar))
|
||||
->manualCrop($this->width, $this->height, $this->x, $this->y)
|
||||
->save();
|
||||
@ -40,7 +41,9 @@ public function save()
|
||||
->width(350)
|
||||
->height(350)
|
||||
->save();
|
||||
ImageOptimizer::optimize($disk->path($avatar));
|
||||
Log::info('Avatar: Optimizing ' . $disk->path($avatar));
|
||||
OptimizeAvatarJob::dispatchSync($disk->path($avatar));
|
||||
//ImageOptimizer::optimize($disk->path($avatar));
|
||||
auth()->user()->artists()->first()->update(compact('avatar'));
|
||||
$this->avatar = null;
|
||||
return redirect(request()->header('Referer'));
|
||||
|
@ -11,6 +11,8 @@
|
||||
use Illuminate\Validation\Rules\File;
|
||||
use Illuminate\Http\RedirectResponse;
|
||||
use Livewire\Attributes\Validate;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
use App\Jobs\OptimizeArtistHeaderJob;
|
||||
|
||||
class Header extends Component
|
||||
{
|
||||
@ -32,7 +34,6 @@ public function save()
|
||||
{
|
||||
$disk = Storage::disk('static');
|
||||
$header = $this->header->store('artist_headers', 'static');
|
||||
|
||||
Image::load($disk->path($header))
|
||||
->manualCrop($this->width, $this->height, $this->x, $this->y)
|
||||
->save();
|
||||
@ -40,7 +41,8 @@ public function save()
|
||||
->width(270)
|
||||
->height(185)
|
||||
->save();
|
||||
ImageOptimizer::optimize($disk->path($header));
|
||||
Log::info('Avatar: Optimizing ' . $disk->path($header));
|
||||
OptimizeArtistHeaderJob::dispatchSync($disk->path($header));
|
||||
auth()->user()->artists()->first()->update(compact('header'));
|
||||
$this->header = null;
|
||||
return redirect(request()->header('Referer'));
|
||||
|
@ -21,7 +21,8 @@
|
||||
@endif
|
||||
</div>
|
||||
<div class="size-small justify-content-center mb-4">
|
||||
{{ number_format($artist->artworks->count()) }} Submitted Artworks
|
||||
{{ number_format($artist->artworks_count) }} Submitted Artworks<br>
|
||||
{{ number_format($artist->episodes_count) }} Artworks Selected
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
Loading…
Reference in New Issue
Block a user