Fix background queue and add image compression on import
- Switch queue from sync to database so Ollama job truly runs in background - Compress uploaded images to max 1200px JPEG 85% before storage Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Sonnet 4.6
parent
f94f53abbd
commit
ecac206a6c
@@ -6,6 +6,8 @@ use App\Jobs\ProcessNailPolishImage;
|
||||
use App\Models\NailPolishImport;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\Storage;
|
||||
use Intervention\Image\ImageManager;
|
||||
use Intervention\Image\Drivers\Gd\Driver;
|
||||
|
||||
class NailPolishImportController extends Controller
|
||||
{
|
||||
@@ -29,8 +31,17 @@ class NailPolishImportController extends Controller
|
||||
'image' => 'required|image|mimes:jpeg,png,jpg,webp|max:10240',
|
||||
]);
|
||||
|
||||
$file = $request->file('image');
|
||||
$path = $file->store('nail-polish-imports', 'public');
|
||||
$file = $request->file('image');
|
||||
$filename = 'nail-polish-imports/' . uniqid() . '.jpg';
|
||||
|
||||
$manager = new ImageManager(new Driver());
|
||||
$image = $manager->read($file->getRealPath());
|
||||
|
||||
// Auf max. 1200px skalieren und als JPEG mit 85% Qualität speichern
|
||||
$image->scaleDown(width: 1200, height: 1200);
|
||||
Storage::disk('public')->put($filename, $image->toJpeg(85));
|
||||
|
||||
$path = $filename;
|
||||
|
||||
$import = NailPolishImport::create([
|
||||
'user_id' => auth()->id(),
|
||||
|
||||
Reference in New Issue
Block a user