upload image from afterStateUpdate of another component

i have a form where I have an image upload input with a few other fields. One of the fields is for barcode, the ideal action I want is the server to check external api if an image for it exists, and if it does, fill the image in automatically in the image upload input. This is my current code, but it seems like the front end preview component is stuck on waiting for size. I don't know if I'm doing it the wrong way, since I've tried a few other ways but this is the one with which I was able to get the farthest. Image Size Is under the file upload limit, so I don't think that's the actual issue.
$image_url = $openfoodfacts_result->getData()['image_url'];
try {
$image_contents = file_get_contents($image_url);
$image_name = basename($image_url);
$local_path = "images/products/$image_name";
Storage::disk('public')->put($local_path, $image_contents);
$set('product_image_url', [$local_path]);
$livewire->dispatch('refreshFileUpload', 'product_image_url');
} catch (\Exception $e) {
dd($e);
}
$image_url = $openfoodfacts_result->getData()['image_url'];
try {
$image_contents = file_get_contents($image_url);
$image_name = basename($image_url);
$local_path = "images/products/$image_name";
Storage::disk('public')->put($local_path, $image_contents);
$set('product_image_url', [$local_path]);
$livewire->dispatch('refreshFileUpload', 'product_image_url');
} catch (\Exception $e) {
dd($e);
}
No description
2 Replies
quantumleaps
quantumleapsOP2mo ago
bump... if anyone knows how to
uarefans
uarefans2mo ago
GitHub
[Bug]: Trying to save the signature to database but failed · Issue ...
What happened? Is their any way to save the signature in to database How to reproduce the bug I'm trying every possible way i know to save the signature Package Version 2.0.0 PHP Version 8.2.0 ...
Want results from more Discord servers?
Add your server