diff --git a/app/Jobs/ConvertToComic.php b/app/Jobs/ConvertToComic.php index e0882ee..6d800ba 100644 --- a/app/Jobs/ConvertToComic.php +++ b/app/Jobs/ConvertToComic.php @@ -21,7 +21,8 @@ class ConvertToComic implements ShouldQueue { $absolutePath = Storage::disk('public')->path($this->photoJob->image_path); - $photoprofile = Photoprofile::where('active', 1)->first(); + $photoprofile = $this->photoJob->photoprofile + ?? Photoprofile::where('active', 1)->first(); $photocommands = []; foreach (explode(PHP_EOL, $photoprofile->commands) as $command) { if (count($photocommands) > 0) $photocommands[] = ' && gmic ' . escapeshellarg($absolutePath) . ' ' . $command . ' -o ' . escapeshellarg($absolutePath); diff --git a/app/Livewire/CameraCapture.php b/app/Livewire/CameraCapture.php index 779202f..cd3e4fd 100644 --- a/app/Livewire/CameraCapture.php +++ b/app/Livewire/CameraCapture.php @@ -4,6 +4,7 @@ namespace App\Livewire; use App\Jobs\ConvertToComic; use App\Models\PhotoJob; +use App\Models\Photoprofile; use Illuminate\Support\Facades\Storage; use Illuminate\Support\Str; use Livewire\Component; @@ -11,6 +12,12 @@ use Livewire\Component; class CameraCapture extends Component { public string $status = ''; + public ?int $photoprofileId = null; + + public function mount(): void + { + $this->photoprofileId = Photoprofile::where('active', 1)->value('id'); + } public function delete(int $jobId): void { @@ -39,6 +46,7 @@ class CameraCapture extends Component $job = PhotoJob::create([ 'image_path' => $filename, 'status' => 'processing', + 'photoprofile_id' => $this->photoprofileId, ]); ConvertToComic::dispatch($job); @@ -55,7 +63,8 @@ class CameraCapture extends Component ]); $hasProcessing = $recentPhotos->contains('status', 'processing'); + $photoprofiles = Photoprofile::where('active', 1)->pluck('name', 'id'); - return view('livewire.camera-capture', compact('recentPhotos', 'hasProcessing')); + return view('livewire.camera-capture', compact('recentPhotos', 'hasProcessing', 'photoprofiles')); } } diff --git a/app/Models/PhotoJob.php b/app/Models/PhotoJob.php index 7df7754..d8c2de6 100644 --- a/app/Models/PhotoJob.php +++ b/app/Models/PhotoJob.php @@ -3,8 +3,14 @@ namespace App\Models; use Illuminate\Database\Eloquent\Model; +use App\Models\Photoprofile; class PhotoJob extends Model { - protected $fillable = ['image_path', 'status']; + protected $fillable = ['image_path', 'status', 'photoprofile_id']; + + public function photoprofile() + { + return $this->belongsTo(Photoprofile::class); + } } diff --git a/database/migrations/2026_06_28_152524_add_photoprofile_id_to_photo_jobs_table.php b/database/migrations/2026_06_28_152524_add_photoprofile_id_to_photo_jobs_table.php new file mode 100644 index 0000000..d04391a --- /dev/null +++ b/database/migrations/2026_06_28_152524_add_photoprofile_id_to_photo_jobs_table.php @@ -0,0 +1,28 @@ +foreignId('photoprofile_id')->nullable()->constrained('photoprofiles')->nullOnDelete(); + }); + } + + /** + * Reverse the migrations. + */ + public function down(): void + { + Schema::table('photo_jobs', function (Blueprint $table) { + $table->dropForeignIdFor(\App\Models\Photoprofile::class); + }); + } +}; diff --git a/database/seeders/PhotoprofileSeeder.php b/database/seeders/PhotoprofileSeeder.php index a88531b..cc8c258 100644 --- a/database/seeders/PhotoprofileSeeder.php +++ b/database/seeders/PhotoprofileSeeder.php @@ -15,6 +15,16 @@ class PhotoprofileSeeder extends Seeder 'active' => true, 'commands' => 'simplelocalcontrast_p 16,2,0,1,1,1,1,1,1,1,1,0 cl_comic 4,1,0,0,1,15,15,1,10,20,6,2,0,0,0,0,0,0,50,50', + ], + [ + 'name' => 'edges', + 'active' => true, + 'commands' => 'fx_canny 5,0.05,0.15,1', + ], + [ + 'name' => 'tron', + 'active' => true, + 'commands' => 'samj_chalkitup 5,2.5,1.5,50,1,5,5,0,0,7,0.8,1.9,7,0', ] ]; diff --git a/resources/views/livewire/camera-capture.blade.php b/resources/views/livewire/camera-capture.blade.php index 00616c1..14607e4 100644 --- a/resources/views/livewire/camera-capture.blade.php +++ b/resources/views/livewire/camera-capture.blade.php @@ -15,6 +15,15 @@ +
+ +
+