O
O
ObehanProger2019-04-13 08:45:08
Laravel
ObehanProger, 2019-04-13 08:45:08

Why is the image file being generated slowly?

A ready-made image descriptor in the base_64 format comes to the server. But for some reason, the command to save the image to a file works very slowly up to 20 seconds, although the image size is only 1.5-2 mb. The process is running on a local server and should be done instantly.

Storage::disk('products')->put('product1.jpg', base64_decode($data['img']));

Answer the question

In order to leave comments, you need to log in

1 answer(s)
V
Vitaliy Orlov, 2019-04-13
@ObehanProger

Try to split like this

echo time();
$imageData = base64_decode($data['img']);
echo time();
Storage::disk('products')->put('product1.jpg', $imageData);
echo time();

and see where exactly the plug is, in b64 or in the save
If in the save, try replacing it with
If the problem disappears, then see what's in Storage you have for fun

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question