N
N
NDll2022-03-11 14:43:21
Laravel
NDll, 2022-03-11 14:43:21

How to send a product photo upload to the queue?

Hello. There is a form for adding a product

622b33cd73417591723363.png

When you click on save, I want to make sure that the data is saved to a table, and the images are sent to the queue for download (the images themselves and the creation of thumbnails)

But so that while the download is in the queue, instead of images, there are download stubs, the

622b348e43290523417726.png

data goes to the server here so

622b35d8c75e2148095279.png

my table structure is like this

products
-id
-name
-price
-image


product_images
-id
-product_id
-image
-path


I thought to do this:
1) create a product
2) count how many files, how many records to make in the product_images table

I also thought to add the is_upload (bool) field to the products and product_images table, which will be a sign of uploading a photo

Answer the question

In order to leave comments, you need to log in

2 answer(s)
S
Sanes, 2022-03-11
@Sanes

Save text fields, then attach a photo. No other way.

P
pLavrenov, 2022-03-11
@pLavrenov

Whether I not really understood correctly the author what such queue.
The only option if you need to send some actions to the queue is to listen to the socket channel, and when processing is performed, send a message to it, as the queue can be completed in half an hour or an hour. The user will close the form already.
In this case, it is better to separate the loading of images into a separate route altogether. You upload a picture, return its ID, add it to the form. Then it will turn out as you expect. You send a request with a picture while the loader is waiting for a response. In most cases, they do so.
norm icons)

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question