Y
Y
Yurka Blokhin2017-07-08 17:47:08
Laravel
Yurka Blokhin, 2017-07-08 17:47:08

How to make a router in Laravel for image caching?

Good afternoon, now I am doing image caching on laravel. For this purpose, I decided to try a router. Tell me how to make the router process requests correctly and find the image, if the image location itself can have several levels of nesting. For example: localhost/assets/catalog/wedr.png/resize/40/40
Now I made such a router

Route::get('/assets/{image?}/{type?}/{h?}/{w?}', 'Dev\[email protected]')->name('image.cache');

But it fails if the image is in a folder.
UPD
I understand that you need to check the image variable with a regular expression, where('image', '[A-Za-z0-9\/\.\-\_]+'); , just how to make the type variable pick up

Answer the question

In order to leave comments, you need to log in

1 answer(s)
U
UksusoFF, 2017-07-09
@blrik

image.intervention.io/use/cache

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question