Oct 17, 2022
0
Level 1
How to determine image uploaded route laravel-filemanager
I'm using "standalone button" for many pages on website (product/create.blade.php, banner/create.blade.php, ...)
$('#lfm').filemanager('image');
And i also call an image handler event after the image is uploaded, based on the answer of Sti3bas:
EventServiceProvider:
protected $listen = [
//...
\UniSharp\LaravelFilemanager\Events\ImageWasUploaded::class => [
\App\Listeners\ResizeUploadedImage::class,
],
];
ResizeUploadedImage listener:
use Intervention\Image\Facades\Image;
public function handle($event)
{
$image = Image::make($event->path());
if($image->width() <= 1000) {
return;
}
$image->fit(500, 500)->save();
}
But all uploaded images are resized, i just want the images of the product to change, so is there any way to determine the image uploaded from the product/create.blade.php page in the "ResizeUploadedImage" event.
Please or to participate in this conversation.