Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to retrieve thumbnail path in the view? #17

Closed
kee0624 opened this issue Sep 1, 2021 · 1 comment
Closed

How to retrieve thumbnail path in the view? #17

kee0624 opened this issue Sep 1, 2021 · 1 comment

Comments

@kee0624
Copy link

kee0624 commented Sep 1, 2021

Hi, I am using lazyload for loading the big image in the front end, and I saw the elfinder is auto-generating the thumbnail on the backend, may I know how do I retrieve the thumbnail path and show it to the front end?

@promatik
Copy link
Member

promatik commented Sep 1, 2021

Hi @kee0624!
ElFinder generates thumbnails on demand, you can create a custom route for that, but I wound't recommend it, it's an heavy process, and if you website has hundreds of page views, it will bloat your server CPU with thumbnail renders.

I recommend you to create the thumbnail when you upload the image.
You can find more on the docs; https://backpackforlaravel.com/docs/4.1/crud-fields#image-1

If you want to generate the thumbnail besides saving your image, after the main image save, you can use something like;

$size = 128;

$image->resize($size, null, function ($c) {$c->aspectRatio();});
Storage::disk($disk)->put("$path/$size/$filename", $image->stream($format, $quality));

For now I'll close this issue since it's not related with FileManager, but feel free to ask anything else if you need ✌

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants